!3098 字符集适配,新增utf8 3种字符序

Merge pull request !3098 from suncan/master
This commit is contained in:
opengauss-bot
2023-03-16 01:41:01 +00:00
committed by Gitee
17 changed files with 520 additions and 36 deletions

View File

@ -31,4 +31,9 @@ Oid binary_need_transform_typeid(Oid typeoid, Oid* collation);
int matchtext_utf8mb4(unsigned char* t, int tlen, unsigned char* p, int plen);
bool is_b_format_collation(Oid collation);
#define IS_UTF8_GENERAL_COLLATION(colloid) \
((colloid == UTF8MB4_GENERAL_CI_COLLATION_OID) || \
(colloid == UTF8MB4_UNICODE_CI_COLLATION_OID) || \
(colloid == UTF8_GENERAL_CI_COLLATION_OID) || \
(colloid == UTF8_UNICODE_CI_COLLATION_OID))
#endif /* GS_UTF8_COLLATION_H */

View File

@ -99,7 +99,17 @@ DESCR("utf8mb4_unicode_ci collation");
DATA(insert OID = 1539 (utf8mb4_bin PGNSP PGUID 7 "utf8mb4_bin" "utf8mb4_bin" "PAD SPACE" _null_));
DESCR("utf8mb4_bin collation");
#define UTF8MB4_BIN_COLLATION_OID 1539
/* GB10830's start with 1536 */
DATA(insert OID = 1551 (utf8_general_ci PGNSP PGUID 7 "utf8_general_ci" "utf8_general_ci" "PAD SPACE" _null_));
DESCR("utf8_general_ci collation");
#define UTF8_GENERAL_CI_COLLATION_OID 1551
DATA(insert OID = 1552 (utf8_unicode_ci PGNSP PGUID 7 "utf8_unicode_ci" "utf8_unicode_ci" "PAD SPACE" _null_));
DESCR("utf8_unicode_ci collation");
#define UTF8_UNICODE_CI_COLLATION_OID 1552
DATA(insert OID = 1553 (utf8_bin PGNSP PGUID 7 "utf8_bin" "utf8_bin" "PAD SPACE" _null_));
DESCR("utf8_bin collation");
#define UTF8_BIN_COLLATION_OID 1553
/* GB10830's start with 1792 */
#define B_FORMAT_COLLATION_OID_MAX 10000

View File

@ -860,9 +860,6 @@ DATA(insert OID = 3272 ( anyset PGNSP PGUID -1 f s H t t \054 0 0 0 anyset_in
((typid) == BYTEAWITHOUTORDERCOLOID || \
(typid) == BYTEAWITHOUTORDERWITHEQUALCOLOID)
#define IsBinaryType(typid) \
((typid) == BLOBOID)
#define IsSupportCharsetType(typid) \
(((typid) == TEXTOID) || \
((typid) == VARCHAROID) || \

View File

@ -10,7 +10,7 @@ query_str_nodes text;
BEGIN
query_str_nodes := 'select * from dbe_perf.node_name';
FOR row_name IN EXECUTE(query_str_nodes) LOOP
delete from pg_catalog.pg_collation where collname in ('utf8mb4_general_ci', 'utf8mb4_unicode_ci', 'utf8mb4_bin', 'binary');
delete from pg_catalog.pg_collation where collname in ('utf8mb4_general_ci', 'utf8mb4_unicode_ci', 'utf8mb4_bin', 'binary', 'utf8_general_ci', 'utf8_unicode_ci', 'utf8_bin');
END LOOP;
return;
END;

View File

@ -10,7 +10,7 @@ query_str_nodes text;
BEGIN
query_str_nodes := 'select * from dbe_perf.node_name';
FOR row_name IN EXECUTE(query_str_nodes) LOOP
delete from pg_catalog.pg_collation where collname in ('utf8mb4_general_ci', 'utf8mb4_unicode_ci', 'utf8mb4_bin', 'binary');
delete from pg_catalog.pg_collation where collname in ('utf8mb4_general_ci', 'utf8mb4_unicode_ci', 'utf8mb4_bin', 'binary', 'utf8_general_ci', 'utf8_unicode_ci', 'utf8_bin');
END LOOP;
return;
END;

View File

@ -56,6 +56,15 @@ select pg_catalog.Insert_pg_collation_temp('utf8mb4_unicode_ci', 11, 10, 7, 'utf
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 1539;
select pg_catalog.Insert_pg_collation_temp('utf8mb4_bin', 11, 10, 7, 'utf8mb4_bin', 'utf8mb4_bin', 'PAD SPACE', null);
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 1551;
select pg_catalog.Insert_pg_collation_temp('utf8_general_ci', 11, 10, 7, 'utf8_general_ci', 'utf8_general_ci', 'PAD SPACE', null);
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 1552;
select pg_catalog.Insert_pg_collation_temp('utf8_unicode_ci', 11, 10, 7, 'utf8_unicode_ci', 'utf8_unicode_ci', 'PAD SPACE', null);
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 1553;
select pg_catalog.Insert_pg_collation_temp('utf8_bin', 11, 10, 7, 'utf8_bin', 'utf8_bin', 'PAD SPACE', null);
DROP FUNCTION pg_catalog.Insert_pg_collation_temp;
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 3147;

View File

@ -56,6 +56,15 @@ select pg_catalog.Insert_pg_collation_temp('utf8mb4_unicode_ci', 11, 10, 7, 'utf
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 1539;
select pg_catalog.Insert_pg_collation_temp('utf8mb4_bin', 11, 10, 7, 'utf8mb4_bin', 'utf8mb4_bin', 'PAD SPACE', null);
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 1551;
select pg_catalog.Insert_pg_collation_temp('utf8_general_ci', 11, 10, 7, 'utf8_general_ci', 'utf8_general_ci', 'PAD SPACE', null);
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 1552;
select pg_catalog.Insert_pg_collation_temp('utf8_unicode_ci', 11, 10, 7, 'utf8_unicode_ci', 'utf8_unicode_ci', 'PAD SPACE', null);
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 1553;
select pg_catalog.Insert_pg_collation_temp('utf8_bin', 11, 10, 7, 'utf8_bin', 'utf8_bin', 'PAD SPACE', null);
DROP FUNCTION pg_catalog.Insert_pg_collation_temp;
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 3147;

View File

@ -58,5 +58,6 @@ extern bool IsTypeTableInInstallationGroup(const Type type_tup);
extern HeapTuple FindPkgVariableType(ParseState* pstate, const TypeName* typname, int32* typmod_p);
extern char* CastPackageTypeName(const char* typName, Oid pkgOid, bool isPackage, bool isPublic = true);
#define ISCOMPLEX(typeid) (typeidTypeRelid(typeid) != InvalidOid)
extern bool IsBinaryType(Oid typid);
#endif /* PARSE_TYPE_H */