Geodatabase+OpenGauss系列产品的支持问题

基于OpenGauss系列主要包括华为gaussDB for openGauss, vastbase G系列产品,GBase8c ,GBase8s,  Shentong For OpenGauss

1. 建库的时候需要将DBCOMPATIBILITY='PG' 否则后续插入数据的时候会出现文本数据录入不进去的问题。

具体可以在pg_database进行查询

openGauss=# select datname,datcompatibility from pg_database;
  datname  | datcompatibility
-----------+------------------
 template1 | A
 test      | A
 test1     | PG
 template0 | A
 postgres  | A

A为oralce,PG为postgresql

原因:默认的是兼容oracle的模式,oracle定义字符的个数是按照字节数定义的,而PG是按照字符数量定义的

oracle例子

如下所示:

定义的最大个数为8个字节,数据库后台的编码是gbk,一个汉字占2个字节,因此最多只能录4个汉字

SQL> desc test11
 名称                                      是否为空? 类型
 ----------------------------------------- -------- ----------------------------
 NAME                                               VARCHAR2(8)

SQL> insert into test11 values ('测试测试');

已创建 1 行。

SQL> insert into test11 values ('测试测试测');
insert into test11 values ('测试测试测')
                           *
第 1 行出现错误:
ORA-12899: 列 "SDE"."TEST11"."NAME" 的值太大 (实际值: 10, 最大值: 8)

2. Shentong兼容oracle模式例子

test=> insert into test11 values ('测试');
INSERT 0 1
test=> insert into test11 values ('测试测');
ERROR:  value too long for type character varying(8)
背景:  referenced column: name
test=> select version();
                                                                                    version
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 (ShenTongGauss 7.0.21 build 8b0a360e for openGauss 5.0.0) compiled at 2023-07-26 09:53:51 commit 0 last mr   on x86_64-unknown-linux-gnu, compiled by g++ (GCC) 7.3.0, 64-bit
(1 行记录)

3. shentong基于PG模式

test1=> create table test11 (name character varying(8));
CREATE TABLE
test1=> insert into test11 values ('测试测试');
INSERT 0 1
test1=> insert into test11 values ('测试测试测试');
INSERT 0 1
test1=> select version();
                                                                                    version
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 (ShenTongGauss 7.0.21 build 8b0a360e for openGauss 5.0.0) compiled at 2023-07-26 09:53:51 commit 0 last mr   on x86_64-unknown-linux-gnu, compiled by g++ (GCC) 7.3.0, 64-bit
(1 行记录)


test1=> select * from pg_database;
  datname  | datdba | encoding | datcollate  |  datctype   | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | dattablespace | datcompatibility |               datacl                | datfrozenxid64 | datminmxid
-----------+--------+----------+-------------+-------------+---------------+--------------+--------------+---------------+--------------+---------------+------------------+-------------------------------------+----------------+------------
 template1 |     10 |        7 | en_US.UTF-8 | en_US.UTF-8 | t             | t            |           -1 |         15646 | 0            |          1663 | A                | {=c/postgres,postgres=CTc/postgres} |          13021 |          2
 test      |  16387 |        7 | en_US.UTF-8 | en_US.UTF-8 | f             | t            |           -1 |         15646 | 12666        |          1663 | A                |                                     |          12666 |          2
 test1     |  16387 |        7 | en_US.UTF-8 | en_US.UTF-8 | f             | t            |           -1 |         15646 | 12666        |          1663 | PG               |                                     |          12666 |          2
 template0 |     10 |        7 | en_US.UTF-8 | en_US.UTF-8 | t             | f            |           -1 |         15646 | 0            |          1663 | A                | {=c/postgres,postgres=CTc/postgres} |          12666 |          2
 postgres  |     10 |        7 | en_US.UTF-8 | en_US.UTF-8 | f             | t            |           -1 |         15646 | 0            |          1663 | A                |                                     |          13376 |          2
(5 行记录)

2.   设置参数如下

behavior_compat_options='bind_procedure_searchpath'

否则存储过程无法查找到public模式下的sequence

3. 修改password_encryption_type参数为0后再创建sde账号。

上述三部针对于所有基于openGauss的商业化产品。 

下面步骤是针对于华为GaussDB for openGauss的

1. 另外需要注意的的openGauss5.0(如果上述商业产品升级到openGauss5.0,华为最新的GaussDB for openGauss已经升级到5.0版本)以及以后版本默认使用的是ustore存储driver,这种存储驱动主打的就是类似oracle和mysql,redo和undo分开存储。

ustore现在还不支持gist索引,如果建gist索引会报如下错误

test_pg=> create table test_postgis(shape geometry);
CREATE TABLE
test_pg=> create index a_ix1 on test_postgis using gist(shape);
ERROR:  gist index is not supported for ustore
test_pg=> \d+ test_postgis
                      数据表 "sde.test_postgis"
 栏位  |   类型   | 校对规则 | 可空的 | 预设 | 存储 | 统计目标 | 描述
-------+----------+----------+--------+------+------+----------+------
 shape | geometry |          |        |      | main |          |
选项: orientation=row, compression=no, storage_type=USTORE, toast.storage_type=USTORE

可以通过 enable_default_ustore_table=off 切换到传统存储引擎

2. behavior_compat_options='select_into_return_null,bind_procedure_searchpath'

你可能感兴趣的:(数据库)