반응형
MariaDB의 CANCAT 키가 10.0에서 작동하지만 이후 버전은 작동하지 않는 테이블
갈레라 클러스터를 사용하기 위해 마리아DB 10.0에서 10.5로 업그레이드하려고 합니다.저희 테이블 중 하나에 키가 있는데 그 이후 버전에서는 사용할 수 없습니다.아래의 오류 및 테이블 구조입니다.
리팩토링 코드는 최후의 수단이므로 문제를 해결할 수 있는 테이블 정의 변경이 있다면 정말 멋질 것 같습니다!
감사해요!
오류
40239번 라인에서 오류 1901(HY000):함수 또는 식 'concat()'
tc_sequence_db_code
,tc_sequence_prefix
,tc_sequence_table_name
)'는 의 GENERATE ALWAYS 절에서 사용할 수 없습니다.tc_sequence_id
테이블 구조
CREATE TABLE `tc_sequence` (
`tc_sequence_id` char(191) AS (concat(`tc_sequence_db_code`,`tc_sequence_prefix`,`tc_sequence_table_name`)),
`tc_sequence_table_name` char(191) NOT NULL,
`tc_sequence_db_code` char(2) NOT NULL DEFAULT '',
`tc_sequence_prefix` char(5) NOT NULL DEFAULT '',
`tc_sequence_next_id` int(11) NOT NULL DEFAULT 0,
`dt_temp_id` varchar(36) DEFAULT NULL,
`tc_sequence_trf_yn` tinyint(1) NOT NULL DEFAULT 0,
UNIQUE KEY `tc_sequence_id` (`tc_sequence_id`),
KEY `tc_sequence_table_name` (`tc_sequence_table_name`),
KEY `dt_temp_id` (`dt_temp_id`),
KEY `tc_sequence_trf_yn` (`tc_sequence_trf_yn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
해결책을 제시해 준 단서에 대해 폴 T에게 감사드립니다.CONCAT 주변의 RTIM은 작동하지 않지만 다음과 같은 기능을 합니다.
CREATE TABLE `tc_sequence` (
`tc_sequence_id` char(191) AS (concat(RTRIM(`tc_sequence_db_code`),RTRIM(`tc_sequence_prefix`),RTRIM(`tc_sequence_table_name`))),
`tc_sequence_table_name` char(191) NOT NULL,
`tc_sequence_db_code` char(2) NOT NULL DEFAULT '',
`tc_sequence_prefix` char(5) NOT NULL DEFAULT '',
`tc_sequence_next_id` int(11) NOT NULL DEFAULT 0,
`dt_temp_id` varchar(36) DEFAULT NULL,
`tc_sequence_trf_yn` tinyint(1) NOT NULL DEFAULT 0,
UNIQUE KEY `tc_sequence_id` (`tc_sequence_id`),
KEY `tc_sequence_table_name` (`tc_sequence_table_name`),
KEY `dt_temp_id` (`dt_temp_id`),
KEY `tc_sequence_trf_yn` (`tc_sequence_trf_yn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
폴 T 정말 고마워요!
언급URL : https://stackoverflow.com/questions/73232987/table-with-cancat-key-in-mariadb-working-in-10-0-but-not-later-versions
반응형
'programing' 카테고리의 다른 글
jQuery로 페이지 스크롤을 프로그래밍 방식으로 비활성화하는 방법 (0) | 2023.09.09 |
---|---|
MySQL 온라인 테스트 도구 (0) | 2023.09.09 |
안드로이드:배열에서 프로그래밍 방식으로 스피너 생성 (0) | 2023.09.09 |
정적 @BeforeClass에서 필드를 자동 배선하는 방법은 무엇입니까? (0) | 2023.09.09 |
오류: int 이전의 식이 필요합니다. (0) | 2023.09.09 |