From: Tom Lane Date: Fri, 24 Dec 2004 15:42:05 +0000 (+0000) Subject: Switch order of WHERE clauses in tab completion queries, as suggested X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=3ec7dca73281024e039a68f081d39a42b9d203ed;p=users%2Fbernd%2Fpostgres.git Switch order of WHERE clauses in tab completion queries, as suggested by Rod Taylor. The foo_is_visible() functions are relatively slow and so it pays to check them after checking the name pattern match. --- diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index f1f09ea5d3..774e830910 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -1807,11 +1807,11 @@ _complete_from_query(int is_schema_query, const char *text, int state) if (completion_squery->selcondition) appendPQExpBuffer(&query_buffer, "%s AND ", completion_squery->selcondition); - appendPQExpBuffer(&query_buffer, "%s AND ", - completion_squery->viscondition); appendPQExpBuffer(&query_buffer, "substring(%s,1,%d)='%s'", completion_squery->result, string_length, e_text); + appendPQExpBuffer(&query_buffer, " AND %s", + completion_squery->viscondition); /* * When fetching relation names, suppress system catalogs