原 gpload加载数据报错 ProgrammingError: ERROR: column "relstorage" does not exist(GP7中的pg_class没有relstorage字段)
Tags: 原创故障处理GreenPlum系统视图gploadrelstoragepg_class
现象
若GPDB数据库是GP7,而客户端是GP6,则使用gpload会报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 2024-07-11 09:46:31|LOG|Truncate table staging_gpload_reusable_969692a10e571c522460f6c33b85687a Traceback (most recent call last): File "/usr/local/greenplum-db-clients-6.19.1/bin/gpload.py", line 3044, in run self.run2() File "/usr/local/greenplum-db-clients-6.19.1/bin/gpload.py", line 3028, in run2 self.do_method() File "/usr/local/greenplum-db-clients-6.19.1/bin/gpload.py", line 2973, in do_method self.do_method_merge() File "/usr/local/greenplum-db-clients-6.19.1/bin/gpload.py", line 2879, in do_method_merge self.create_external_table() File "/usr/local/greenplum-db-clients-6.19.1/bin/gpload.py", line 2528, in create_external_table resultList = self.db.query(sql.encode('utf-8')).getresult() File "/usr/local/greenplum-db-clients-6.19.1/bin/ext/pygresql/pg.py", line 313, in query return self.db.query(qstr) ProgrammingError: ERROR: column "relstorage" does not exist LINE 19: relstorage = 'x' and ^ HINT: Perhaps you meant to reference the column "pg_attribute.attstorage". |
分析
$GPHOME/bin/gpload.py
文件的问题:
1 2 3 4 5 | [root@mdw bin]# cat gpload.py -n | grep relstorage 2111 relstorage = 'x' and 2204 relstorage = 'x' and 2522 AND c.relstorage IN ('h', 'a', 'c','x','v','') [root@mdw bin]# |
pgclass.relstorage列在GP6中存在,在GP7中取消了该列。 该列表示表的存储模式,其中:a= 追加优化,c= 面向列的,h = 堆表, v = 虚拟,x= 外部表。
参考:https://dbaup.com/greenplumzhongdepg_classshitu.html
注意:PG中,经过验证,所有版本都不存在该字段。
将GP6和GP7的gpload文件进行比对发现: