Skip to content
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

[CBRD-25241] Add SQL syntax to change the owner of the serial #5038

Merged
merged 33 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a099d37
ADD Syntax ALTER SERIAL .. OWNER TO ..
Mar 5, 2024
92e8f4e
1) style: Change au_change_serial_owner_method() to au_change_serial_…
Mar 9, 2024
9715b94
Modified to the contents confirmed on 03/12 day, 1) style : change au…
Mar 15, 2024
83dcf82
style : Modify the authenticate.c file line
Mar 15, 2024
3f38dfb
style : Correct error in authenticate.c file
Mar 15, 2024
2639f0a
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Mar 15, 2024
52d900d
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Mar 31, 2024
44445ae
feat : Added semantic_check logic and error message MSGCAT_SET_PARSER…
Apr 2, 2024
18ec8b8
Correction of typos
Apr 2, 2024
bc9390e
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Apr 2, 2024
8452dd9
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Apr 8, 2024
f4d1e81
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Apr 11, 2024
0fc408b
style: Change au_change_serial_owner() to au_change_serial_owner_meth…
Apr 11, 2024
2de54d1
style: Fixed PT_CHANGE_OWNER conditional check inside semantic_check
Apr 11, 2024
0098e21
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Apr 12, 2024
c0047b2
style: Re-registering where error message text is broken
Apr 12, 2024
0086df5
style: Re-registering where error message text is broken (ko_KR.euckr)
Apr 12, 2024
43dc688
Crash actions
Apr 22, 2024
a824ba6
Crash actions
Apr 22, 2024
c853e97
Crash actions(3)
Apr 22, 2024
3206bab
Crash actions(4)
Apr 22, 2024
da187a8
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Apr 22, 2024
6f33842
1) feat : Add container_11(c1 ~ c11), 2) style : Change opt_serial_op…
Apr 22, 2024
6e4e986
style: Re-registering where error message text is broken (ko_KR.euckr)
Apr 23, 2024
a2bf082
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Apr 28, 2024
c3e1196
1) style: Deduplicate PT_SERIAL_COMMENT and COMMENT, 2) style : Retur…
Apr 28, 2024
98e3a9c
1) style: Fixed to make it clear to users when changing the SERIAL OW…
Apr 28, 2024
aa6b1aa
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Apr 29, 2024
f6f7b74
style: Add PT_SERIAL_COMMENT again
Apr 29, 2024
6414578
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
Apr 30, 2024
32385bf
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
May 3, 2024
d19a4d2
Merge remote-tracking branch 'upstream/develop' into CBRD-25241
May 8, 2024
6108a05
style: Delete PT_SERIAL_COMMENT
May 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions msg/de_DE.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Außer virtuellem Speicher: %1$d Bytes können nicht zugewiesen werden.
Expand Down
1 change: 1 addition & 0 deletions msg/en_US.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Out of virtual memory: unable to allocate %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/en_US/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1933,6 +1933,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Out of virtual memory: unable to allocate %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/es_ES.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Sin memoria virtual: incapaz de asignar %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/fr_FR.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Mémoire virtuelle épuisée: impossible d'allouer %1$d octets.
Expand Down
1 change: 1 addition & 0 deletions msg/it_IT.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Fuori di memoria virtuale: Impossibile allocare %1$d byte.
Expand Down
1 change: 1 addition & 0 deletions msg/ja_JP.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 バチャールメモリーが足りません。: %1$dバイトがアロケーションできません。
Expand Down
1 change: 1 addition & 0 deletions msg/km_KH.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Out of virtual memory: unable to allocate %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/ko_KR.euckr/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 À̸§ ¹Ù²Ù±â´Â ¼ÒÀ¯ÀÚ¸¦ º¯°æÇÒ ¼ö ¾ø½À´Ï´Ù.
316 À̸§ ¹Ù²Ù±â´Â °°Àº À̸§À¸·Î º¯°æÇÒ ¼ö ¾ø½À´Ï´Ù.
317 ½Äº°ÀÚ´Â LIMIT Àý ¾È¿¡ ÀÖÀ» ¼ö ¾ø½À´Ï´Ù.
318 DBA ¹× DBA ±×·ì ±¸¼º¿ø¸¸ %1$sÀ»(¸¦) ¼öÇàÇÒ ¼ö ÀÖ½À´Ï´Ù.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 °¡»ó ¸Þ¸ð¸® ¾øÀ½: %1$d ¹ÙÀÌÆ®¸¦ ÇÒ´çÇÒ ¼ö ¾ø½À´Ï´Ù.
Expand Down
1 change: 1 addition & 0 deletions msg/ko_KR.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 이름 바꾸기는 소유자를 변경할 수 없습니다.
316 이름 바꾸기는 같은 이름으로 변경할 수 없습니다.
317 식별자는 LIMIT 절 안에 있을 수 없습니다.
318 DBA 및 DBA 그룹 구성원만 %1$s을(를) 수행할 수 있습니다.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 가상 메모리 없음: %1$d 바이트를 할당할 수 없습니다.
Expand Down
1 change: 1 addition & 0 deletions msg/ro_RO.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Memorie virtuală epuizată: nu s-au putut aloca %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/tr_TR.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Sanal bellek yetersiz: %1$d bayt bölüm ayıramadı.
Expand Down
1 change: 1 addition & 0 deletions msg/vi_VN.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Out of virtual memory: unable to allocate %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/zh_CN.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1933,6 +1933,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 虚拟内存耗尽: 无法申请 %1$d 字节.
Expand Down
119 changes: 105 additions & 14 deletions src/parser/csql_grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ typedef struct
PT_NODE *c10;
} container_10;

typedef struct
{
PT_NODE *c1;
PT_NODE *c2;
PT_NODE *c3;
PT_NODE *c4;
PT_NODE *c5;
PT_NODE *c6;
PT_NODE *c7;
PT_NODE *c8;
PT_NODE *c9;
PT_NODE *c10;
PT_NODE *c11;
} container_11;

void csql_yyerror_explicit (int line, int column);
void csql_yyerror (const char *s);

Expand Down Expand Up @@ -264,6 +279,7 @@ static bool is_in_create_trigger = false;
#define CONTAINER_AT_7(a) (a).c8
#define CONTAINER_AT_8(a) (a).c9
#define CONTAINER_AT_9(a) (a).c10
#define CONTAINER_AT_10(a) (a).c11

#define YEN_SIGN_TEXT "(\0xa1\0xef)"
#define DOLLAR_SIGN_TEXT "$"
Expand Down Expand Up @@ -304,6 +320,7 @@ typedef enum
SERIAL_MIN,
SERIAL_CYCLE,
SERIAL_CACHE,
SERIAL_CHANGE_OWNER,
} SERIAL_DEFINE;

typedef enum
Expand Down Expand Up @@ -551,6 +568,7 @@ static char *g_plcsql_text;
container_3 c3;
container_4 c4;
container_10 c10;
container_11 c11;
struct json_table_column_behavior jtcb;
}

Expand Down Expand Up @@ -1025,8 +1043,10 @@ static char *g_plcsql_text;

/* define rule type (container) */
/*{{{*/
%type <c10> opt_serial_option_list
%type <c10> serial_option_list
%type <c11> opt_serial_option_list
%type <c11> serial_option_list
%type <c11> opt_serial_option_list_or_owner_clause
%type <c11> serial_owner_clause
%type <c10> connect_info
%type <c10> alter_server_list

Expand All @@ -1038,6 +1058,7 @@ static char *g_plcsql_text;
%type <c3> ref_rule_list
%type <c3> opt_ref_rule_list
%type <c3> of_serial_option
%type <c3> of_serial_owner_clause
%type <c3> delete_from_using
%type <c3> trigger_status_or_priority_or_change_owner

Expand Down Expand Up @@ -3285,8 +3306,8 @@ class_name_for_synonym
opt_serial_option_list
: /* empty */
{{ DBG_TRACE_GRAMMAR(opt_serial_option_list, : );
container_10 ctn;
memset(&ctn, 0x00, sizeof(container_10));
container_11 ctn;
memset(&ctn, 0x00, sizeof(container_11));
$$ = ctn;
}}
| serial_option_list
Expand All @@ -3295,6 +3316,23 @@ opt_serial_option_list
}}
;

opt_serial_option_list_or_owner_clause
: /* empty */
{{ DBG_TRACE_GRAMMAR(opt_serial_option_list_or_owner_clause, : );
container_11 ctn;
memset(&ctn, 0x00, sizeof(container_11));
$$ = ctn;
}}
| serial_option_list
{{ DBG_TRACE_GRAMMAR(opt_serial_option_list_or_owner_clause, | serial_option_list);
$$ = $1;
}}
| serial_owner_clause
{{ DBG_TRACE_GRAMMAR(opt_serial_option_list_or_owner_clause, | serial_owner_clause);
$$ = $1;
}}
;

serial_option_list
: serial_option_list of_serial_option
{{ DBG_TRACE_GRAMMAR(serial_option_list, : serial_option_list of_serial_option);
Expand All @@ -3316,7 +3354,7 @@ serial_option_list
* 10: no_cache,
*/

container_10 ctn = $1;
container_11 ctn = $1;

PT_NODE* node = pt_top(this_parser);
PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
Expand Down Expand Up @@ -3411,8 +3449,8 @@ serial_option_list
* 10: no_cache,
*/

container_10 ctn;
memset(&ctn, 0x00, sizeof(container_10));
container_11 ctn;
memset(&ctn, 0x00, sizeof(container_11));

switch(TO_NUMBER (CONTAINER_AT_0($1)))
{
Expand Down Expand Up @@ -3489,6 +3527,51 @@ of_serial_option
DBG_PRINT}}
;

serial_owner_clause
: of_serial_owner_clause
{{ DBG_TRACE_GRAMMAR(serial_owner_clause, : of_serial_owner_clause);
/* container order
* 1: start_val
*
* 2: increment_val,
*
* 3: max_val,
* 4: no_max,
*
* 5: min_val,
* 6: no_min,
*
* 7: cyclic,
* 8: no_cyclic,
*
* 9: cached_num_val,
* 10: no_cache,
* 11: owner,
*/

container_11 ctn;
memset(&ctn, 0x00, sizeof(container_11));

switch(TO_NUMBER (CONTAINER_AT_0($1)))
{
case SERIAL_CHANGE_OWNER:
ctn.c11 = CONTAINER_AT_1($1);
break;
}

$$ = ctn;

DBG_PRINT}}
;

of_serial_owner_clause
: OWNER TO identifier
{{ DBG_TRACE_GRAMMAR(of_serial_owner_clause, : OWNER TO identifier);
container_3 ctn;
SET_CONTAINER_3(ctn, FROM_NUMBER(SERIAL_CHANGE_OWNER), $3, NULL);
$$ = ctn;
DBG_PRINT}}
;

opt_replace
: /* empty */
Expand Down Expand Up @@ -3735,9 +3818,9 @@ alter_stmt
| ALTER /* 1 */
SERIAL /* 2 */
serial_name /* 3 */
opt_serial_option_list /* 4 */
opt_serial_option_list_or_owner_clause /* 4 */
opt_comment_spec /* 5 */
{{ DBG_TRACE_GRAMMAR(alter_stmt, | ALTER SERIAL serial_name opt_serial_option_list opt_comment_spec);
{{ DBG_TRACE_GRAMMAR(alter_stmt, | ALTER SERIAL serial_name opt_serial_option_list_or_owner_clause opt_comment_spec);
/* container order
* 0: start_val
* 1: increment_val,
Expand All @@ -3749,6 +3832,7 @@ alter_stmt
* 7: no_cyclic,
* 8: cached_num_val,
* 9: no_cache,
* 10: owner,
*/

PT_NODE *serial_name = $3;
Expand All @@ -3762,6 +3846,7 @@ alter_stmt
int no_cyclic = (int) TO_NUMBER (CONTAINER_AT_7 ($4));
PT_NODE *cached_num_val = CONTAINER_AT_8 ($4);
int no_cache = (int) TO_NUMBER (CONTAINER_AT_9 ($4));
PT_NODE *owner_name = CONTAINER_AT_10 ($4);
PT_NODE *comment = $5;

PT_NODE *node = parser_new_node (this_parser, PT_ALTER_SERIAL);
Expand All @@ -3778,21 +3863,27 @@ alter_stmt
node->info.serial.no_cyclic = no_cyclic;
node->info.serial.cached_num_val = cached_num_val;
node->info.serial.no_cache = no_cache;
node->info.serial.owner_name = owner_name;
node->info.serial.comment = comment;
node->info.serial.code = PT_SERIAL_OPTION;
}

$$ = node;
PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)

if (!start_val && !increment_val && !max_val && !min_val
&& cyclic == 0 && no_max == 0 && no_min == 0
&& no_cyclic == 0 && !cached_num_val && no_cache == 0
&& comment == NULL)
&& no_cyclic == 0 && !cached_num_val && no_cache == 0)
{
PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
MSGCAT_SEMANTIC_SERIAL_ALTER_NO_OPTION, 0);
if (owner_name != NULL)
{
node->info.serial.code = PT_CHANGE_OWNER;
}
else if (comment != NULL)
{
node->info.serial.code = PT_SERIAL_COMMENT;
}
}

DBG_PRINT}}
| ALTER /* 1 */
{ /* 2 */
Expand Down
6 changes: 5 additions & 1 deletion src/parser/parse_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,9 @@ typedef enum
PT_CHANGE_INDEX_COMMENT,
PT_CHANGE_INDEX_STATUS,
PT_ADD_MEMBERS, /* alter user type */
PT_DROP_MEMBERS
PT_DROP_MEMBERS,
PT_SERIAL_OPTION, /* alter serial type */
PT_SERIAL_COMMENT
jongmin-won marked this conversation as resolved.
Show resolved Hide resolved
} PT_ALTER_CODE;

/* Codes for trigger event type */
Expand Down Expand Up @@ -2180,7 +2182,9 @@ struct pt_serial_info
PT_NODE *max_val; /* PT_VALUE */
PT_NODE *min_val; /* PT_VALUE */
PT_NODE *cached_num_val; /* PT_VALUE */
PT_NODE *owner_name; /* PT_NAME */
PT_NODE *comment; /* PT_VALUE */
PT_ALTER_CODE code; /* PT_SERIAL_OPTION, PT_CHANGE_OWNER, PT_SERIAL_COMMENT */
int cyclic;
int no_max;
int no_min;
Expand Down
Loading
Loading