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-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

Merged
merged 35 commits into from
Feb 13, 2025

Conversation

jongmin-won
Copy link
Contributor

@jongmin-won jongmin-won commented Dec 19, 2024

http://jira.cubrid.org/browse/CBRD-25719

Purpose

  1. CREATE TRIGGER 실행 시, SP가 포함된 경우 db_trigger 카탈로그의 action 및 condition 컬럼에 [user_schema]가 추가되지 않는 문제를 수정합니다.
  2. 과거의 unload 파일을 loaddb --no-user-specified-name 유틸리티를 사용해 트리거를 생성할 때, 실제 소유자를 찾아 db_trigger 카탈로그에 저장하도록 수정합니다.

Implementation

CREATE TRIGGER 동작 순서 수정

  1. Trigger 구문
CREATE TRIGGER [example]
BEFORE UPDATE ON [history](score)
EXECUTE INSERT INTO [update_logs] VALUES ([obj].[event_code], [obj].[score], '2024-12-11');
  1. Trigger 파싱 이후, Query Rewrite 수행 결과
insert into [dba.update_logs] values ([obj].[event_code], [obj].[score], '2024-12-11')
  1. Action(PT_SCOPE) 파싱 결과
  • 수정 전: 아래 SCOPE 구문이 에러 없이 정상적으로 컴파일된 경우, 2번에서 Rewrite된 구문을 카탈로그에 저장함.
SCOPE___ insert into [dba.update_logs] values ([obj].[event_code], [obj].[score], '2024-12-11') FROM ON  [public.history] obj, [public.history] new
  1. Action(PT_SCOPE)파싱 이후, Query Rewrite 수행 결과 (추가된 부분)
  • 수정 후: Action(PT_SCOPE) 파싱 결과를 다시 Rewrite하여 나온 구문을 카탈로그에 저장함.
insert into [dba.update_logs] ([event_code], [score], [dt]) values ([obj].[event_code], [obj].[score], '2024-12-11')

Remarks

N/A

jongmin-won added 3 commits December 19, 2024 21:08
…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.
@jongmin-won jongmin-won self-assigned this Dec 20, 2024
jongmin-won added 5 commits December 20, 2024 13:22
… rewritten into an unexecutable rewrite query.
…rewritten into an unexecutable rewrite query.
… rewritten into an unexecutable rewrite query.
…rewritten into an unexecutable rewrite query.
@jongmin-won jongmin-won changed the title [CBRD-25719] When executing loaddb with a past unload file (no user_schema) containing a trigger, the loaddb operation succeeds, but the trigger execution fails. [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 Dec 20, 2024
@jongmin-won jongmin-won marked this pull request as ready for review December 23, 2024 04:11
jongmin-won added 3 commits December 24, 2024 00:57
…ory management issue in the change_trigger_action_query function might be the cause and have made adjustments to address it.
src/parser/compile.c Outdated Show resolved Hide resolved
src/parser/compile.c Outdated Show resolved Hide resolved
@jongmin-won
Copy link
Contributor Author

jongmin-won commented Dec 31, 2024

github-checks / memory-monitor-check (pull_request) 에서 src/parser/compile.c: FAIL 된 이유

  • .github/workflows/check.yml 파일의 memory-monitor-check 부분에서 compile.c 파일이 grep 되어 FAIL 된 것으로 확인 됩니다.
filename=$(basename $f)
check_server_file=$(grep -F $filename cubrid/CMakeLists.txt)
if [ "$check_server_file" == "" ]; then
  result_for_f="PASS"
fi

예제

  • 아래 예시와 같이 compile.c 패턴이 grep에 출력 됨을 확인 했습니다.
$ filename=$(basename compile.c)
$ echo $filename
compile.c
$ grep $filename cubrid/CMakeLists.txt
  ${SP_DIR}/pl_struct_**compile.c**pp
  ${XASL_DIR}/**compile_c**ontext.h
$ grep -F $filename cubrid/CMakeLists.txt 
  ${SP_DIR}/pl_struct_**compile.c**pp

해결방안

개발 2팀 희수님이 담당으로 알고있어 관련 내용을 전달했습니다.

@jongmin-won
Copy link
Contributor Author

다음 PR (CUBRID/cubrid-testcases#2019) 에서 test_sql 과 test_plcsql 의 TC 답안지를 수정 합니다.

@jongmin-won jongmin-won removed the request for review from vimkim February 3, 2025 00:29
src/parser/compile.c Outdated Show resolved Hide resolved
src/parser/compile.c Outdated Show resolved Hide resolved
@jongmin-won jongmin-won merged commit d7d2d3a into CUBRID:develop Feb 13, 2025
9 of 10 checks passed
@jongmin-won jongmin-won deleted the CBRD-25719 branch February 13, 2025 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants