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 14 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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group can perform %1$s.
jongmin-won marked this conversation as resolved.
Show resolved Hide resolved

$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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group 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 @@ -1931,6 +1931,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group 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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group 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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group 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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group 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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group 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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group 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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 µ¿ÀǾî "%1$s"ÀÌ(°¡) Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.
315 À̸§ ¹Ù²Ù±â´Â ¼ÒÀ¯ÀÚ¸¦ º¯°æÇÒ ¼ö ¾ø½À´Ï´Ù.
316 À̸§ ¹Ù²Ù±â´Â °°Àº À̸§À¸·Î º¯°æÇÒ ¼ö ¾ø½À´Ï´Ù.
317 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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 동의어 "%1$s"이(가) 존재하지 않습니다.
315 이름 바꾸기는 소유자를 변경할 수 없습니다.
316 이름 바꾸기는 같은 이름으로 변경할 수 없습니다.
317 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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group 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 @@ -1930,6 +1930,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group 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 @@ -1937,6 +1937,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group 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 @@ -1931,6 +1931,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
314 Synonym "%1$s" does not exist.
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 DBA and members of DBA group can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 虚拟内存耗尽: 无法申请 %1$d 字节.
Expand Down
1 change: 0 additions & 1 deletion src/object/authenticate.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ static void au_print_cache (int cache, FILE * fp);
static void au_print_grant_entry (DB_SET * grants, int grant_index, FILE * fp);
static void au_print_auth (MOP auth, FILE * fp);

static int au_change_serial_owner (MOP serial_mop, MOP owner_mop, bool by_class_owner_change);
static int au_delete_auth_of_dropping_user (MOP user);

/*
Expand Down
1 change: 1 addition & 0 deletions src/object/authenticate.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ extern int au_check_user (void);
extern char *au_get_user_name (MOP obj);
extern bool au_is_dba_group_member (MOP user);
extern bool au_is_user_group_member (MOP group_user, MOP user);
extern int au_change_serial_owner (MOP serial_mop, MOP owner_mop, bool by_class_owner_change);
extern void au_change_serial_owner_method (MOP obj, DB_VALUE * return_val, DB_VALUE * serial_val, DB_VALUE * owner_val);

/* debugging functions */
Expand Down
38 changes: 34 additions & 4 deletions src/parser/csql_grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -3757,21 +3757,51 @@ alter_stmt
node->info.serial.cached_num_val = cached_num_val;
node->info.serial.no_cache = no_cache;
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 (comment != NULL)
{
node->info.serial.code = PT_SERIAL_COMMENT;
}
}

DBG_PRINT}}
| ALTER /* 1 */
SERIAL /* 2 */
serial_name /* 3 */
OWNER TO identifier /* 4, 5, 6 */
opt_comment_spec /* 7 */
jongmin-won marked this conversation as resolved.
Show resolved Hide resolved
{{ DBG_TRACE_GRAMMAR(alter_stmt, | ALTER SERIAL serial_name OWNER TO identifier opt_comment_spec);

PT_NODE *node = parser_new_node (this_parser, PT_ALTER_SERIAL);

if (node)
{
node->info.serial.serial_name = $3;
node->info.serial.owner_name = $6;
node->info.serial.comment = $7;
node->info.serial.code = PT_CHANGE_OWNER;
}

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

if (node->info.serial.owner_name == NULL)
{
if (node->info.serial.comment != NULL)
{
node->info.serial.code = PT_SERIAL_COMMENT;
}
}
DBG_PRINT}}
| ALTER /* 1 */
{ /* 2 */
PT_NODE* node = parser_new_node(this_parser, PT_ALTER_INDEX);
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 @@ -1443,7 +1443,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 @@ -2178,7 +2180,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
143 changes: 89 additions & 54 deletions src/parser/parse_tree_cl.c
Original file line number Diff line number Diff line change
Expand Up @@ -8103,67 +8103,101 @@ pt_print_alter_serial (PARSER_CONTEXT * parser, PT_NODE * p)
q = pt_append_nulstring (parser, q, "alter serial ");
q = pt_append_varchar (parser, q, r1);

if (p->info.serial.start_val != NULL)
switch (p->info.serial.code)
{
r1 = pt_print_bytes (parser, p->info.serial.start_val);
q = pt_append_nulstring (parser, q, " start with ");
q = pt_append_varchar (parser, q, r1);
}
case PT_SERIAL_OPTION:
if (p->info.serial.start_val != NULL)
{
r1 = pt_print_bytes (parser, p->info.serial.start_val);
q = pt_append_nulstring (parser, q, " start with ");
q = pt_append_varchar (parser, q, r1);
}

if (p->info.serial.increment_val)
{
r1 = pt_print_bytes (parser, p->info.serial.increment_val);
q = pt_append_nulstring (parser, q, " increment by ");
q = pt_append_varchar (parser, q, r1);
}
if (p->info.serial.increment_val)
{
r1 = pt_print_bytes (parser, p->info.serial.increment_val);
q = pt_append_nulstring (parser, q, " increment by ");
q = pt_append_varchar (parser, q, r1);
}

if (p->info.serial.min_val)
{
r1 = pt_print_bytes (parser, p->info.serial.min_val);
q = pt_append_nulstring (parser, q, " minvalue ");
q = pt_append_varchar (parser, q, r1);
}
else if (p->info.serial.no_min == 1)
{
q = pt_append_nulstring (parser, q, " nomaxvalue ");
}
if (p->info.serial.min_val)
{
r1 = pt_print_bytes (parser, p->info.serial.min_val);
q = pt_append_nulstring (parser, q, " minvalue ");
q = pt_append_varchar (parser, q, r1);
}
else if (p->info.serial.no_min == 1)
{
q = pt_append_nulstring (parser, q, " nomaxvalue ");
}

if (p->info.serial.max_val)
{
r1 = pt_print_bytes (parser, p->info.serial.max_val);
q = pt_append_nulstring (parser, q, " maxvalue ");
q = pt_append_varchar (parser, q, r1);
}
else if (p->info.serial.no_max == 1)
{
q = pt_append_nulstring (parser, q, " nomaxvalue ");
}
if (p->info.serial.max_val)
{
r1 = pt_print_bytes (parser, p->info.serial.max_val);
q = pt_append_nulstring (parser, q, " maxvalue ");
q = pt_append_varchar (parser, q, r1);
}
else if (p->info.serial.no_max == 1)
{
q = pt_append_nulstring (parser, q, " nomaxvalue ");
}

if (p->info.serial.cyclic)
{
q = pt_append_nulstring (parser, q, " cycle ");
}
else if (p->info.serial.no_cyclic == 1)
{
q = pt_append_nulstring (parser, q, " nocycle ");
}
if (p->info.serial.cyclic)
{
q = pt_append_nulstring (parser, q, " cycle ");
}
else if (p->info.serial.no_cyclic == 1)
{
q = pt_append_nulstring (parser, q, " nocycle ");
}

if (p->info.serial.cached_num_val && p->info.serial.no_cache != 1)
{
r1 = pt_print_bytes (parser, p->info.serial.cached_num_val);
q = pt_append_nulstring (parser, q, " cache ");
q = pt_append_varchar (parser, q, r1);
}
else if (p->info.serial.no_cache != 0)
{
q = pt_append_nulstring (parser, q, " nocache ");
}
if (p->info.serial.cached_num_val && p->info.serial.no_cache != 1)
{
r1 = pt_print_bytes (parser, p->info.serial.cached_num_val);
q = pt_append_nulstring (parser, q, " cache ");
q = pt_append_varchar (parser, q, r1);
}
else if (p->info.serial.no_cache != 0)
{
q = pt_append_nulstring (parser, q, " nocache ");
}

if (p->info.serial.comment != NULL)
{
r1 = pt_print_bytes (parser, p->info.serial.comment);
q = pt_append_nulstring (parser, q, " comment ");
q = pt_append_varchar (parser, q, r1);
if (p->info.serial.comment != NULL)
{
r1 = pt_print_bytes (parser, p->info.serial.comment);
q = pt_append_nulstring (parser, q, " comment ");
q = pt_append_varchar (parser, q, r1);
}
break;

case PT_CHANGE_OWNER:
if (p->info.serial.owner_name != NULL)
{
r1 = pt_print_bytes (parser, p->info.serial.owner_name);
q = pt_append_nulstring (parser, q, " owner to ");
q = pt_append_varchar (parser, q, r1);
}

if (p->info.serial.comment != NULL)
{
r1 = pt_print_bytes (parser, p->info.serial.comment);
q = pt_append_nulstring (parser, q, " comment ");
q = pt_append_varchar (parser, q, r1);
}
break;

case PT_SERIAL_COMMENT:
if (p->info.serial.comment != NULL)
{
r1 = pt_print_bytes (parser, p->info.serial.comment);
q = pt_append_nulstring (parser, q, " comment ");
q = pt_append_varchar (parser, q, r1);
}
break;

default:
assert (false);
break;
}

return q;
Expand Down Expand Up @@ -8273,6 +8307,7 @@ pt_apply_alter_serial (PARSER_CONTEXT * parser, PT_NODE * p, void *arg)
PT_APPLY_WALK (parser, p->info.serial.increment_val, arg);
PT_APPLY_WALK (parser, p->info.serial.min_val, arg);
PT_APPLY_WALK (parser, p->info.serial.max_val, arg);
PT_APPLY_WALK (parser, p->info.serial.owner_name, arg);
return p;
}

Expand Down
1 change: 1 addition & 0 deletions src/parser/parser_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@
#define MSGCAT_SEMANTIC_SYNONYM_NOT_EXIST MSGCAT_SEMANTIC_NO(314)
#define MSGCAT_SEMANTIC_SYNONYM_RENAME_CANNOT_CHANGE_OWNER MSGCAT_SEMANTIC_NO(315)
#define MSGCAT_SEMANTIC_SYNONYM_RENAME_CANNOT_SAME_NAME MSGCAT_SEMANTIC_NO(316)
#define MSGCAT_SEMANTIC_SERIAL_NOT_OWNER MSGCAT_SEMANTIC_NO(317)

/* Message id in the set MSGCAT_SET_PARSER_RUNTIME */
#define MSGCAT_RUNTIME_NO(n) n
Expand Down
Loading
Loading