mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 10:51:16 +02:00
Tab complete "TABLE whatever DROP CONSTRAINT" with a constraint name.
Jeff Janes
This commit is contained in:
parent
b2a01b9ad1
commit
68386fc15b
@ -579,6 +579,14 @@ static const SchemaQuery Query_for_list_of_views = {
|
|||||||
" and pg_catalog.quote_ident(c1.relname)='%s'"\
|
" and pg_catalog.quote_ident(c1.relname)='%s'"\
|
||||||
" and pg_catalog.pg_table_is_visible(c2.oid)"
|
" and pg_catalog.pg_table_is_visible(c2.oid)"
|
||||||
|
|
||||||
|
/* the silly-looking length condition is just to eat up the current word */
|
||||||
|
#define Query_for_constraint_of_table \
|
||||||
|
"SELECT pg_catalog.quote_ident(conname) "\
|
||||||
|
" FROM pg_catalog.pg_class c1, pg_catalog.pg_constraint con "\
|
||||||
|
" WHERE c1.oid=conrelid and (%d = pg_catalog.length('%s'))"\
|
||||||
|
" and pg_catalog.quote_ident(c1.relname)='%s'"\
|
||||||
|
" and pg_catalog.pg_table_is_visible(c1.oid)"
|
||||||
|
|
||||||
/* the silly-looking length condition is just to eat up the current word */
|
/* the silly-looking length condition is just to eat up the current word */
|
||||||
#define Query_for_list_of_tables_for_trigger \
|
#define Query_for_list_of_tables_for_trigger \
|
||||||
"SELECT pg_catalog.quote_ident(relname) "\
|
"SELECT pg_catalog.quote_ident(relname) "\
|
||||||
@ -1337,6 +1345,14 @@ psql_completion(char *text, int start, int end)
|
|||||||
pg_strcasecmp(prev2_wd, "DROP") == 0 &&
|
pg_strcasecmp(prev2_wd, "DROP") == 0 &&
|
||||||
pg_strcasecmp(prev_wd, "COLUMN") == 0)
|
pg_strcasecmp(prev_wd, "COLUMN") == 0)
|
||||||
COMPLETE_WITH_ATTR(prev3_wd, "");
|
COMPLETE_WITH_ATTR(prev3_wd, "");
|
||||||
|
/* If we have TABLE <sth> DROP CONSTRAINT, provide list of constraints */
|
||||||
|
else if (pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
|
||||||
|
pg_strcasecmp(prev2_wd, "DROP") == 0 &&
|
||||||
|
pg_strcasecmp(prev_wd, "CONSTRAINT") == 0)
|
||||||
|
{
|
||||||
|
completion_info_charp = prev3_wd;
|
||||||
|
COMPLETE_WITH_QUERY(Query_for_constraint_of_table);
|
||||||
|
}
|
||||||
/* ALTER TABLE ALTER [COLUMN] <foo> */
|
/* ALTER TABLE ALTER [COLUMN] <foo> */
|
||||||
else if ((pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
|
else if ((pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
|
||||||
pg_strcasecmp(prev2_wd, "COLUMN") == 0) ||
|
pg_strcasecmp(prev2_wd, "COLUMN") == 0) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user