[专家问答]阿里数据库专家曾文旌为你解决数据库那些事
请教一个oracle_fdw的问题:在oracle中有表SQL> desc pgtest1; Name Null? Type ----------------------------------------- -------- ---------------------------- ID NUMBER(38) DTIME DATE ELEC_ADDR VARCHAR2(256 CHAR)
SQL> select * from pgtest1;
ID DTIME ELEC_ADDR
---------- ------------------- ----------
1 2016-05-20 10:12:12 ss
2 2012-02-02 12:12:12 ss
通过fdw到postgresql这边查询结果是postgres=# d pgtest1;
Foreign table 'public.pgtest1'
Column
Type
Modifiers
FDW Options
id
integer
dtime
timestamp without time zone
elec_addr
character varying(256)
Server: oracle_svrFDW Options: (schema 'TEST', 'table' 'PGTEST1')
postgres=# select * from pgtest1;ERROR: error executing query: OCIStmtExecute failed to execute remote queryDETAIL: ORA-01406: 提取的列值被截断
把dtime字段写成date类型也是同样的错误postgres=# d pgtest5;
Foreign table 'public.pgtest5'
Column
Type
Modifiers
FDW Options
id
integer
dtime
date
elec_addr
character varying(256)
Server: oracle_svrFDW Options: (schema 'TEST', 'table' 'PGTEST1')
postgres=# select * from pgtest5;ERROR: error executing query: OCIStmtExecute failed to execute remote queryDETAIL: ORA-01406: 提取的列值被截断
在oracle中把数据TRUNCATE掉之后SQL> TRUNCATE TABLE PGTEST1;
Table truncated.
SQL> select * from pgtest1;
no rows selected
在postgresql中查询postgres=# select * from pgtest1;
(0 rows)
说明oracle_fdw是通信是OK的,请问这是什么原因?oracle的date类型在postgresql外部表中我应该写成什么类型?
赞1
踩0