forked from huawei/openGauss-server
!116 【openGauss】fix matveiws ALTER column problem
Merge pull request !116 from 宋清怡/master
This commit is contained in:
commit
896b2eb4f5
|
|
@ -12456,7 +12456,8 @@ static void ATExecSetRelOptions(Relation rel, List* defList, AlterTableType oper
|
|||
|
||||
/* Validate */
|
||||
switch (rel->rd_rel->relkind) {
|
||||
case RELKIND_RELATION: {
|
||||
case RELKIND_RELATION:
|
||||
case RELKIND_MATVIEW: {
|
||||
/* this options only can be used when define a new relation.
|
||||
* forbid to change or reset these options.
|
||||
*/
|
||||
|
|
@ -12485,8 +12486,7 @@ static void ATExecSetRelOptions(Relation rel, List* defList, AlterTableType oper
|
|||
break;
|
||||
}
|
||||
case RELKIND_TOASTVALUE:
|
||||
case RELKIND_VIEW:
|
||||
case RELKIND_MATVIEW:{
|
||||
case RELKIND_VIEW: {
|
||||
(void)heap_reloptions(rel->rd_rel->relkind, newOptions, true);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ typedef struct RelationMetaData {
|
|||
StdRdOptionsGetStringData((relation)->rd_options, filesystem, FILESYSTEM_GENERAL)
|
||||
|
||||
#define RelationIsCUFormat(relation) \
|
||||
((RELKIND_RELATION == relation->rd_rel->relkind) && \
|
||||
((RELKIND_RELATION == relation->rd_rel->relkind || RELKIND_MATVIEW == relation->rd_rel->relkind) && \
|
||||
pg_strcasecmp(RelationGetOrientation(relation), ORIENTATION_COLUMN) == 0)
|
||||
|
||||
#define RelationIsRowFormat(relation) \
|
||||
|
|
@ -259,14 +259,15 @@ static inline RedisHtlAction RelationGetAppendMode(Relation rel)
|
|||
* Return the relations' orientation. Pax format includes ORC format.
|
||||
*/
|
||||
#define RelationIsPAXFormat(relation) \
|
||||
((RELKIND_RELATION == relation->rd_rel->relkind) && \
|
||||
((RELKIND_RELATION == relation->rd_rel->relkind || RELKIND_MATVIEW == relation->rd_rel->relkind) && \
|
||||
pg_strcasecmp(RelationGetOrientation(relation), ORIENTATION_ORC) == 0)
|
||||
|
||||
/* RelationIsColStore
|
||||
* Return relation whether is column store, which includes CU format and PAX format.
|
||||
*/
|
||||
#define RelationIsColStore(relation) \
|
||||
((RELKIND_RELATION == relation->rd_rel->relkind) && (RelationIsCUFormat(relation) || RelationIsPAXFormat(relation)))
|
||||
((RELKIND_RELATION == relation->rd_rel->relkind || RELKIND_MATVIEW == relation->rd_rel->relkind) && \
|
||||
(RelationIsCUFormat(relation) || RelationIsPAXFormat(relation)))
|
||||
|
||||
#define RelationOptionIsDfsStore(optionValue) (optionValue && 0 == pg_strncasecmp(optionValue, HDFS, strlen(HDFS)))
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ SELECT * FROM mvtest_tm ORDER BY type;
|
|||
(0 rows)
|
||||
|
||||
REFRESH MATERIALIZED VIEW mvtest_tm;
|
||||
ALTER MATERIALIZED VIEW mvtest_tm set (orientation=column); --error
|
||||
ERROR: Un-support feature
|
||||
DETAIL: Option "orientation" doesn't allow ALTER
|
||||
CREATE UNIQUE INDEX mvtest_tm_type ON mvtest_tm (type);
|
||||
SELECT * FROM mvtest_tm ORDER BY type;
|
||||
type | totamt
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ EXPLAIN (analyze on, costs off)
|
|||
CREATE MATERIALIZED VIEW mvtest_tm AS SELECT type, sum(amt) AS totamt FROM mvtest_t GROUP BY type WITH NO DATA;
|
||||
SELECT * FROM mvtest_tm ORDER BY type;
|
||||
REFRESH MATERIALIZED VIEW mvtest_tm;
|
||||
ALTER MATERIALIZED VIEW mvtest_tm set (orientation=column); --error
|
||||
CREATE UNIQUE INDEX mvtest_tm_type ON mvtest_tm (type);
|
||||
SELECT * FROM mvtest_tm ORDER BY type;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue