Skip to content

gb18030_2022

Support GB18030-2022 and UTF-8 conversion

ivorysql · Support GB18030-2022 and UTF-8 conversion

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
9190gb18030_2022ivorysql1.0SIMApache-2.0C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-dt-NoYesNoYesnoyes

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY1.019 18 17 16 15ivorysql-
RPMPIGSTY6.019 18 17 16 15ivorysql-$v-
DEBPIGSTY6.019 18 17 16 15ivorysql-$v-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
el8.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
el9.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
el9.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
el10.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
el10.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
d12.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
d12.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
d13.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
d13.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u22.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u22.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u24.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u24.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u26.x86_64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A
u26.aarch64PIGSTY 6.0PIGSTY 5.6N/AN/AN/A

Source

github.com/IvorySQL/IvorySQL/tree/2269591ea327cbf99e7db6f518ec6ecf67cdadee/contrib/gb18030_2022

pig build pkg ivorysql;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install ivorysql;		# install by package name
pig install gb18030_2022;		# install by extension name

pig install gb18030_2022 -v 19;   # install for PG 19
pig install gb18030_2022 -v 18;   # install for PG 18

Create this extension with:

CREATE EXTENSION gb18030_2022;

Usage

Sources:

This module supplies the GB18030-2022 mapping tables for conversion between GB18030 and UTF8. IvorySQL calls the conversion hooks registered when the library loads in a server process.

IvorySQL 6.0 is based on PostgreSQL 19.0 and ships gb18030_2022 at SQL version 1.0. The PG18 package uses IvorySQL 5.6.

IvorySQL creates gb18030_2022 during database initialization. In a UTF-8 database a privileged session can load the library and check the mapping.

LOAD 'gb18030_2022';
SELECT convert_from(decode('A8BC', 'hex'), 'GB18030');

The byte pair in the example decodes to ḿ (U+1E3F). The SQL installation script loads the library in the installing session. For other connections, ensure the library is loaded in each process that needs the 2022 mappings.

Table reader