执行以下查询后:
insert into regiony
(m_valid, m_validationreport,
m_creation_timestamp, m_creation_user,
m_modification_timestamp, m_modification_user,
instance, kod_regionu, nazwa_gminy, kod_teryt)
select distinct NULL, NULL, now(), 'abc', now(),
'abc', NULL, region_poch, export_gmina, replace(teryt, '|', '') from source_table
我收到以下错误:
错误:列" m_valid"是boolean类型,但expression是text
类型我尝试将null值转换为boolean(NULL :: boolean),并且它适用于boolean,但目标表(regiony)中的实例列的类型为XML,PGSQL拒绝将NULL转换为XML。将null转换为xml后,我得到:
错误:无法识别类型为xml的等号运算符
有什么建议吗?接收空值的所有列都允许空值,而且我的想法用完了。
干杯, 扬
答案 0 :(得分:1)
尝试在没有显式空语句的情况下重写它,让PG根据需要处理它们:
insert into regiony (
m_creation_timestamp,
m_creation_user,
m_modification_timestamp,
m_modification_user,
kod_regionu,
nazwa_gminy,
kod_teryt
)
select distinct now(),
'abc',
now(),
'abc',
region_poch,
export_gmina,
replace(teryt, '|', '')
from source_table