diff options
| author | Kevin Grittner <kgrittn@postgresql.org> | 2013-07-16 12:55:44 -0500 | 
|---|---|---|
| committer | Kevin Grittner <kgrittn@postgresql.org> | 2013-07-16 12:55:44 -0500 | 
| commit | cc1965a99bf87005f431804bbda0f723887a04d6 (patch) | |
| tree | 694801e2e7a34a1247ad7858b9c81ff16a90ac39 /src/bin/psql/tab-complete.c | |
| parent | 7f7485a0cde92aa4ba235a1ffe4dda0ca0b6cc9a (diff) | |
Add support for REFRESH MATERIALIZED VIEW CONCURRENTLY.
This allows reads to continue without any blocking while a REFRESH
runs.  The new data appears atomically as part of transaction
commit.
Review questioned the Assert that a matview was not a system
relation.  This will be addressed separately.
Reviewed by Hitoshi Harada, Robert Haas, Andres Freund.
Merged after review with security patch f3ab5d4.
Diffstat (limited to 'src/bin/psql/tab-complete.c')
| -rw-r--r-- | src/bin/psql/tab-complete.c | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index a67d2cdd909..5b7fc93eb26 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -2871,6 +2871,12 @@ psql_completion(char *text, int start, int end)  	else if (pg_strcasecmp(prev3_wd, "REFRESH") == 0 &&  			 pg_strcasecmp(prev2_wd, "MATERIALIZED") == 0 &&  			 pg_strcasecmp(prev_wd, "VIEW") == 0) +		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_matviews, +								   " UNION SELECT 'CONCURRENTLY'"); +	else if (pg_strcasecmp(prev4_wd, "REFRESH") == 0 && +			 pg_strcasecmp(prev3_wd, "MATERIALIZED") == 0 && +			 pg_strcasecmp(prev2_wd, "VIEW") == 0 && +			 pg_strcasecmp(prev_wd, "CONCURRENTLY") == 0)  		COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_matviews, NULL);  	else if (pg_strcasecmp(prev4_wd, "REFRESH") == 0 &&  			 pg_strcasecmp(prev3_wd, "MATERIALIZED") == 0 && @@ -2879,6 +2885,11 @@ psql_completion(char *text, int start, int end)  	else if (pg_strcasecmp(prev5_wd, "REFRESH") == 0 &&  			 pg_strcasecmp(prev4_wd, "MATERIALIZED") == 0 &&  			 pg_strcasecmp(prev3_wd, "VIEW") == 0 && +			 pg_strcasecmp(prev2_wd, "CONCURRENTLY") == 0) +		COMPLETE_WITH_CONST("WITH DATA"); +	else if (pg_strcasecmp(prev5_wd, "REFRESH") == 0 && +			 pg_strcasecmp(prev4_wd, "MATERIALIZED") == 0 && +			 pg_strcasecmp(prev3_wd, "VIEW") == 0 &&  			 pg_strcasecmp(prev_wd, "WITH") == 0)  	{  		static const char *const list_WITH_DATA[] = @@ -2889,6 +2900,12 @@ psql_completion(char *text, int start, int end)  	else if (pg_strcasecmp(prev6_wd, "REFRESH") == 0 &&  			 pg_strcasecmp(prev5_wd, "MATERIALIZED") == 0 &&  			 pg_strcasecmp(prev4_wd, "VIEW") == 0 && +			 pg_strcasecmp(prev3_wd, "CONCURRENTLY") == 0 && +			 pg_strcasecmp(prev_wd, "WITH") == 0) +		COMPLETE_WITH_CONST("DATA"); +	else if (pg_strcasecmp(prev6_wd, "REFRESH") == 0 && +			 pg_strcasecmp(prev5_wd, "MATERIALIZED") == 0 && +			 pg_strcasecmp(prev4_wd, "VIEW") == 0 &&  			 pg_strcasecmp(prev2_wd, "WITH") == 0 &&  			 pg_strcasecmp(prev_wd, "NO") == 0)  		COMPLETE_WITH_CONST("DATA"); | 
