Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
1a511800
Commit
1a511800
authored
Jul 20, 2015
by
Alvaro Herrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve tab-completion for DROP POLICY
Backpatch to 9.5. Author: Pavel Stěhule
parent
f8d67ca8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
src/bin/psql/tab-complete.c
src/bin/psql/tab-complete.c
+25
-1
No files found.
src/bin/psql/tab-complete.c
View file @
1a511800
...
@@ -742,6 +742,19 @@ static const SchemaQuery Query_for_list_of_matviews = {
...
@@ -742,6 +742,19 @@ static const SchemaQuery Query_for_list_of_matviews = {
" FROM pg_catalog.pg_tablesample_method "\
" FROM pg_catalog.pg_tablesample_method "\
" WHERE substring(pg_catalog.quote_ident(tsmname),1,%d)='%s'"
" WHERE substring(pg_catalog.quote_ident(tsmname),1,%d)='%s'"
#define Query_for_list_of_policies \
" SELECT pg_catalog.quote_ident(polname) "\
" FROM pg_catalog.pg_policy " \
" WHERE substring(pg_catalog.quote_ident(polname),1,%d)='%s'"
#define Query_for_list_of_tables_for_policy \
"SELECT pg_catalog.quote_ident(relname) "\
" FROM pg_catalog.pg_class"\
" WHERE (%d = pg_catalog.length('%s'))"\
" AND oid IN "\
" (SELECT polrelid FROM pg_catalog.pg_policy "\
" WHERE pg_catalog.quote_ident(polname)='%s')"
/*
/*
* This is a list of all "things" in Pgsql, which can show up after CREATE or
* This is a list of all "things" in Pgsql, which can show up after CREATE or
* DROP; and there is also a query to get a list of them.
* DROP; and there is also a query to get a list of them.
...
@@ -2891,15 +2904,26 @@ psql_completion(const char *text, int start, int end)
...
@@ -2891,15 +2904,26 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_QUERY
(
Query_for_list_of_event_triggers
);
COMPLETE_WITH_QUERY
(
Query_for_list_of_event_triggers
);
}
}
/* DROP POLICY <name> */
else
if
(
pg_strcasecmp
(
prev2_wd
,
"DROP"
)
==
0
&&
pg_strcasecmp
(
prev_wd
,
"POLICY"
)
==
0
)
{
COMPLETE_WITH_QUERY
(
Query_for_list_of_policies
);
}
/* DROP POLICY <name> ON */
/* DROP POLICY <name> ON */
else
if
(
pg_strcasecmp
(
prev3_wd
,
"DROP"
)
==
0
&&
else
if
(
pg_strcasecmp
(
prev3_wd
,
"DROP"
)
==
0
&&
pg_strcasecmp
(
prev2_wd
,
"POLICY"
)
==
0
)
pg_strcasecmp
(
prev2_wd
,
"POLICY"
)
==
0
)
{
COMPLETE_WITH_CONST
(
"ON"
);
COMPLETE_WITH_CONST
(
"ON"
);
}
/* DROP POLICY <name> ON <table> */
/* DROP POLICY <name> ON <table> */
else
if
(
pg_strcasecmp
(
prev4_wd
,
"DROP"
)
==
0
&&
else
if
(
pg_strcasecmp
(
prev4_wd
,
"DROP"
)
==
0
&&
pg_strcasecmp
(
prev3_wd
,
"POLICY"
)
==
0
&&
pg_strcasecmp
(
prev3_wd
,
"POLICY"
)
==
0
&&
pg_strcasecmp
(
prev_wd
,
"ON"
)
==
0
)
pg_strcasecmp
(
prev_wd
,
"ON"
)
==
0
)
COMPLETE_WITH_SCHEMA_QUERY
(
Query_for_list_of_tables
,
NULL
);
{
completion_info_charp
=
prev2_wd
;
COMPLETE_WITH_QUERY
(
Query_for_list_of_tables_for_policy
);
}
/* DROP RULE */
/* DROP RULE */
else
if
(
pg_strcasecmp
(
prev3_wd
,
"DROP"
)
==
0
&&
else
if
(
pg_strcasecmp
(
prev3_wd
,
"DROP"
)
==
0
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment