diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-12-16 14:02:28 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-12-16 14:02:28 -0500 |
commit | cf0cab868aa4758b7eec5f9412f2ec74acda7f45 (patch) | |
tree | 08134fff4f15b4609259765407e391e671bdd1bb /src/bin/psql/command.c | |
parent | c49d926833fa6a987e3f9a66027f4a01d7a008be (diff) | |
download | postgresql-cf0cab868aa4758b7eec5f9412f2ec74acda7f45.tar.gz postgresql-cf0cab868aa4758b7eec5f9412f2ec74acda7f45.zip |
Remove psql support for server versions preceding 9.2.
Per discussion, we'll limit support for old servers to those branches
that can still be built easily on modern platforms, which as of now
is 9.2 and up.
Aside from removing code that is dead per the assumption of
server >= 9.2, I tweaked the startup warning for unsupported versions
to complain about too-old servers as well as too-new ones. The
warning that "Some psql features might not work" applies precisely
to both cases.
Discussion: https://postgr.es/m/2923349.1634942313@sss.pgh.pa.us
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 56 |
1 files changed, 10 insertions, 46 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index f5b2cd12c0f..ccd7b481084 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -1103,21 +1103,7 @@ exec_command_ef_ev(PsqlScanState scan_state, bool active_branch, NULL, true); int lineno = -1; - if (pset.sversion < (is_func ? 80400 : 70400)) - { - char sverbuf[32]; - - formatPGVersionNumber(pset.sversion, false, - sverbuf, sizeof(sverbuf)); - if (is_func) - pg_log_error("The server (version %s) does not support editing function source.", - sverbuf); - else - pg_log_error("The server (version %s) does not support editing view definitions.", - sverbuf); - status = PSQL_CMD_ERROR; - } - else if (!query_buf) + if (!query_buf) { pg_log_error("no query buffer"); status = PSQL_CMD_ERROR; @@ -2418,21 +2404,7 @@ exec_command_sf_sv(PsqlScanState scan_state, bool active_branch, buf = createPQExpBuffer(); obj_desc = psql_scan_slash_option(scan_state, OT_WHOLE_LINE, NULL, true); - if (pset.sversion < (is_func ? 80400 : 70400)) - { - char sverbuf[32]; - - formatPGVersionNumber(pset.sversion, false, - sverbuf, sizeof(sverbuf)); - if (is_func) - pg_log_error("The server (version %s) does not support showing function source.", - sverbuf); - else - pg_log_error("The server (version %s) does not support showing view definitions.", - sverbuf); - status = PSQL_CMD_ERROR; - } - else if (!obj_desc) + if (!obj_desc) { if (is_func) pg_log_error("function name is required"); @@ -3611,7 +3583,12 @@ connection_warnings(bool in_startup) else if (in_startup) printf("%s (%s)\n", pset.progname, PG_VERSION); - if (pset.sversion / 100 > client_ver / 100) + /* + * Warn if server's major version is newer than ours, or if server + * predates our support cutoff (currently 9.2). + */ + if (pset.sversion / 100 > client_ver / 100 || + pset.sversion < 90200) printf(_("WARNING: %s major version %s, server major version %s.\n" " Some psql features might not work.\n"), pset.progname, @@ -5271,8 +5248,7 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid, * ensure the right view gets replaced. Also, check relation kind * to be sure it's a view. * - * Starting with 9.2, views may have reloptions (security_barrier) - * and from 9.4 onwards they may also have WITH [LOCAL|CASCADED] + * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED] * CHECK OPTION. These are not part of the view definition * returned by pg_get_viewdef() and so need to be retrieved * separately. Materialized views (introduced in 9.3) may have @@ -5291,24 +5267,12 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid, "ON c.relnamespace = n.oid WHERE c.oid = %u", oid); } - else if (pset.sversion >= 90200) - { - printfPQExpBuffer(query, - "SELECT nspname, relname, relkind, " - "pg_catalog.pg_get_viewdef(c.oid, true), " - "c.reloptions AS reloptions, " - "NULL AS checkoption " - "FROM pg_catalog.pg_class c " - "LEFT JOIN pg_catalog.pg_namespace n " - "ON c.relnamespace = n.oid WHERE c.oid = %u", - oid); - } else { printfPQExpBuffer(query, "SELECT nspname, relname, relkind, " "pg_catalog.pg_get_viewdef(c.oid, true), " - "NULL AS reloptions, " + "c.reloptions AS reloptions, " "NULL AS checkoption " "FROM pg_catalog.pg_class c " "LEFT JOIN pg_catalog.pg_namespace n " |