-
Notifications
You must be signed in to change notification settings - Fork 123
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-25719] Fix an issue where [user_schema] was incorrectly stored or missing in the condition and action_definition columns of the db_trigger catalog during trigger creation or loaddb execution with legacy unload files #5729
base: develop
Are you sure you want to change the base?
Conversation
…ondition columns of the db_trigger catalog when SP is included when performing create trigger, 2. When creating a trigger with the loaddb --no-user-specified-name utility, find the actual owner and modify it to save it in the db_trigger catalog, 3. When performing the unload utility, remove the owner’s [user_schema] from the action and condition columns.
…s the unload utility.
a1c8fcc
to
195ad20
Compare
…en into an unexecutable rewrite query.
… rewritten into an unexecutable rewrite query.
…rewritten into an unexecutable rewrite query.
… rewritten into an unexecutable rewrite query.
…rewritten into an unexecutable rewrite query.
…rewritten into an unexecutable rewrite query.
…s rewritten into an unexecutable rewrite query.
…ory management issue in the change_trigger_action_query function might be the cause and have made adjustments to address it.
char *p = NULL; | ||
const char *remove_eval_prefix = "evaluate ("; | ||
size_t remove_eval_suffix_len; | ||
|
||
p = strstr (result, remove_eval_prefix); | ||
if (p != NULL) | ||
{ | ||
p = (char *) memmove (p, p + strlen (remove_eval_prefix), strlen (p) - strlen (remove_eval_prefix) + 1); | ||
} | ||
|
||
remove_eval_suffix_len = strlen (p); | ||
if (remove_eval_suffix_len > 0 && p[remove_eval_suffix_len - 1] == ')') | ||
{ | ||
p[remove_eval_suffix_len - 1] = '\0'; | ||
} |
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.
PR #5731 에서 다루는 코드와 동일한 것 같은데 함수로 만들어서 동일하게 유지 하는 것이 좋을 듯 합니다.
result_len = strlen (result) + 1; | ||
if (result_len < 0) | ||
{ | ||
return NULL; | ||
} | ||
|
||
new_trigger_stmt_str = (char *) malloc (result_len); | ||
if (new_trigger_stmt_str == NULL) | ||
{ | ||
er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_OUT_OF_VIRTUAL_MEMORY, 1, (size_t) result_len); | ||
return NULL; | ||
} | ||
|
||
snprintf (new_trigger_stmt_str, result_len, "%s", result); | ||
|
||
return new_trigger_stmt_str; |
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.
return result;
로 충분할 듯 합니다.
따로 메모리를 할당해서 복사할 필요가 없는 함수로 보입니다.
필요하다면 이 함수의 리턴을 받은 쪽에서 별도 메모리가 필요한지 판단하면 될 것으로 보입니다.
* with_evaluate(in): | ||
*/ | ||
static char * | ||
change_trigger_action_query (PARSER_CONTEXT * parser, PT_NODE * statement, int with_evaluate) |
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.
with_evaluate 변수를 char*로 받아서 널 여부를 판단하는 것이 더 효율적이겠습니다.
이렇게 수정한다면 strstr()을 이 함수를 호출하는 쪽에서 한번만 해도 되겠네요
free_and_init (*new_trigger_stmt); | ||
*new_trigger_stmt = strdup (new_trigger_stmt_str); | ||
free_and_init (new_trigger_stmt_str); |
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.
제가 위쪽에서 단 코멘트 중에 "return result; 로 충분할 듯 합니다." 이러 내용이 있었는데요,
그 코드를 수정하지 않는다면 반대로 이 부분에서 단지 아래와 같은 한 줄만 사용하면 될 것 같습니다.
*new_trigger_stmt = new_trigger_stmt_str;
http://jira.cubrid.org/browse/CBRD-25719
Purpose
Implementation
CREATE TRIGGER 동작 순서 수정
Remarks
N/A