-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Support Invisible Columns #401
base: POLARDB_11_DEV
Are you sure you want to change the base?
Conversation
Hi @YinZheng-Sun ~ Congratulations to your first PR to PolarDB. 🎉 Please make sure that your PR conforms the standard, and has passed all the checks. We will review your PR as soon as possible. |
Hey @YinZheng-Sun : Something wrong occuried during the checks of your commit 😟, please check the detail:
|
847f80f
to
1ccabe7
Compare
Hey @YinZheng-Sun : Something wrong occuried during the checks of your commit 😟, please check the detail:
|
Hey @YinZheng-Sun : Congratulations~ 🎉 Your commit has passed all the checks. Please wait for further manual review. |
src/backend/commands/sequence.c
Outdated
@@ -162,6 +162,7 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq) | |||
ColumnDef *coldef = makeNode(ColumnDef); | |||
|
|||
coldef->inhcount = 0; | |||
coldef->is_invisible = false; | |||
coldef->is_local = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不需要特意初始化,makeNode会做初始化。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), | ||
errmsg("cannot alter system column \"%s\"", | ||
colName))); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议考虑下分区表和继承表的场景,父子表的行为应该一致。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* lookup the attribute | ||
*/ | ||
attr_rel = heap_open(AttributeRelationId, RowExclusiveLock); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
考虑下typed table场景,是否要支持。
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), | ||
errmsg("cannot alter system column \"%s\"", | ||
colName))); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同样要考虑分区表、继承表
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
((Form_pg_attribute) GETSTRUCT(tuple))->attisinvisible = true; | ||
|
||
CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样会导致所有列都可隐藏,应当至少有一列是非隐藏的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -220,6 +220,7 @@ PG_KEYWORD("integer", INTEGER, COL_NAME_KEYWORD) | |||
PG_KEYWORD("intersect", INTERSECT, RESERVED_KEYWORD) | |||
PG_KEYWORD("interval", INTERVAL, COL_NAME_KEYWORD) | |||
PG_KEYWORD("into", INTO, RESERVED_KEYWORD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
作为保留关键字过于严格
b INT | ||
); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
类比Oracle,对比下隐藏列的join行为。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
INSERT INTO TEST_INVISIBLE_TBL2 VALUES (1); | ||
INSERT INTO TEST_INVISIBLE_TBL2 VALUES (1, 1); | ||
INSERT INTO TEST_INVISIBLE_TBL2 (a, b) VALUES (1, 1); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
select I_SEL_t.* FROM I_SEL_t;
select (I_SEL_t).* FROM I_SEL_t;
这种场景如何处理?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
增加了测试
|
||
INSERT INTO TEST_INVISIBLE_TBL3 VALUES (1); | ||
INSERT INTO TEST_INVISIBLE_TBL3 (a, b) VALUES (1, 1); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CREATE TABLE I_SEL_type(i int, j int INVISIBLE, k int);
SELECT (1)::I_SEL_t;
SELECT (1,2)::I_SEL_t;
SELECT (1,2)::I_SEL_type;
SELECT ((1,2)::I_SEL_type).*;
SELECT ((1,2)::I_SEL_type).i;
SELECT ((1,2)::I_SEL_type).j;
对于类型转换的测试场景可以在测试一下
| ALTER opt_column ColId SET INVISIBLE | ||
{ | ||
AlterTableCmd *n = makeNode(AlterTableCmd); | ||
n->subtype = AT_SetInvisible; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
添加ALTER TABLE I_SEL_t MODIFY i VISIBLE;
Modify语法
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
c668e4f
to
c86bcd0
Compare
Hey @YinZheng-Sun : Something wrong occuried during the checks of your commit 😟, please check the detail:
|
… be more than one
c86bcd0
to
af1722c
Compare
Hey @YinZheng-Sun : Congratulations~ 🎉 Your commit has passed all the checks. Please wait for further manual review. |
Hey @YinZheng-Sun : Congratulations~ 🎉 Your commit has passed all the checks. Please wait for further manual review. |
Problem Summary:
Fix #389
After Oracle 12c, users have the ability to customize hidden columns in an invisible form. Hidden columns play a crucial role in facilitating the migration and development of user applications, significantly enhancing the flexibility of table usage.
The objective of this project is to provide support for users to specify the hidden attribute of a column during the CREATE TABLE or ALTER TABLE statements, while being compatible with Oracle's syntax for hidden columns.
What type of PR is this:
Checklist: