diff options
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 " |