@@ -369,47 +369,12 @@ static const SchemaQuery Query_for_list_of_constraints_with_schema = {
369369 NULL
370370};
371371
372- /* The bit masks for the following three functions come from
373- * src/include/catalog/pg_trigger.h.
374- */
375- static const SchemaQuery Query_for_list_of_insertables = {
376- /* catname */
377- "pg_catalog.pg_class c" ,
378- /* selcondition */
379- "(c.relkind = 'r' OR (c.relkind = 'v' AND c.relhastriggers AND EXISTS "
380- "(SELECT 1 FROM pg_catalog.pg_trigger t WHERE t.tgrelid = c.oid AND t.tgtype & (1 << 2) <> 0)))" ,
381- /* viscondition */
382- "pg_catalog.pg_table_is_visible(c.oid)" ,
383- /* namespace */
384- "c.relnamespace" ,
385- /* result */
386- "pg_catalog.quote_ident(c.relname)" ,
387- /* qualresult */
388- NULL
389- };
390-
391- static const SchemaQuery Query_for_list_of_deletables = {
392- /* catname */
393- "pg_catalog.pg_class c" ,
394- /* selcondition */
395- "(c.relkind = 'r' OR (c.relkind = 'v' AND c.relhastriggers AND EXISTS "
396- "(SELECT 1 FROM pg_catalog.pg_trigger t WHERE t.tgrelid = c.oid AND t.tgtype & (1 << 3) <> 0)))" ,
397- /* viscondition */
398- "pg_catalog.pg_table_is_visible(c.oid)" ,
399- /* namespace */
400- "c.relnamespace" ,
401- /* result */
402- "pg_catalog.quote_ident(c.relname)" ,
403- /* qualresult */
404- NULL
405- };
406-
372+ /* Relations supporting INSERT, UPDATE or DELETE */
407373static const SchemaQuery Query_for_list_of_updatables = {
408374 /* catname */
409375 "pg_catalog.pg_class c" ,
410376 /* selcondition */
411- "(c.relkind = 'r' OR (c.relkind = 'v' AND c.relhastriggers AND EXISTS "
412- "(SELECT 1 FROM pg_catalog.pg_trigger t WHERE t.tgrelid = c.oid AND t.tgtype & (1 << 4) <> 0)))" ,
377+ "c.relkind IN ('r', 'f', 'v')" ,
413378 /* viscondition */
414379 "pg_catalog.pg_table_is_visible(c.oid)" ,
415380 /* namespace */
@@ -2362,7 +2327,7 @@ psql_completion(char *text, int start, int end)
23622327 /* Complete DELETE FROM with a list of tables */
23632328 else if (pg_strcasecmp (prev2_wd , "DELETE" ) == 0 &&
23642329 pg_strcasecmp (prev_wd , "FROM" ) == 0 )
2365- COMPLETE_WITH_SCHEMA_QUERY (Query_for_list_of_deletables , NULL );
2330+ COMPLETE_WITH_SCHEMA_QUERY (Query_for_list_of_updatables , NULL );
23662331 /* Complete DELETE FROM <table> */
23672332 else if (pg_strcasecmp (prev3_wd , "DELETE" ) == 0 &&
23682333 pg_strcasecmp (prev2_wd , "FROM" ) == 0 )
@@ -2732,7 +2697,7 @@ psql_completion(char *text, int start, int end)
27322697 /* Complete INSERT INTO with table names */
27332698 else if (pg_strcasecmp (prev2_wd , "INSERT" ) == 0 &&
27342699 pg_strcasecmp (prev_wd , "INTO" ) == 0 )
2735- COMPLETE_WITH_SCHEMA_QUERY (Query_for_list_of_insertables , NULL );
2700+ COMPLETE_WITH_SCHEMA_QUERY (Query_for_list_of_updatables , NULL );
27362701 /* Complete "INSERT INTO <table> (" with attribute names */
27372702 else if (pg_strcasecmp (prev4_wd , "INSERT" ) == 0 &&
27382703 pg_strcasecmp (prev3_wd , "INTO" ) == 0 &&
0 commit comments