在JOIN中使用ROW谓词时,Informix与EXCEPTION_ACCESS_VIOLATION崩溃.ON子句

时间:2014-07-30 11:33:35

标签: sql informix

在Informix数据库上运行以下查询时,数据库会因EXCEPTION_ACCESS_VIOLATION而崩溃。

select 
  trim(systables.owner) owner,
  trim(systables.tabname) tabname,
  trim(sysconstraints.constrname) constrname,
  sysindexes.part1, sysindexes.part2,
  sysindexes.part3, sysindexes.part4,
  sysindexes.part5, sysindexes.part6,
  sysindexes.part7, sysindexes.part8,
  sysindexes.part9, sysindexes.part10,
  sysindexes.part11, sysindexes.part12,
  sysindexes.part13, sysindexes.part14,
  sysindexes.part15, sysindexes.part16
from
  sysconstraints 
    join systables 
      on sysconstraints.tabid = systables.tabid 
    join sysindexes 
      on row (sysconstraints.owner, sysconstraints.idxname) 
       = row (sysindexes.owner, sysindexes.idxname) 
order by
  sysconstraints.owner asc, 
  systables.tabname asc, 
  sysconstraints.constrname asc

我使用的数据库是Windows上的Informix 12.10的开发人员版。

1 个答案:

答案 0 :(得分:0)

我可以跟踪问题,与row()子句中join .. on谓词的使用严格相关:

-- causes issues
from
  sysconstraints 
    join systables 
      on sysconstraints.tabid = systables.tabid 
    join sysindexes 
      on row (sysconstraints.owner, sysconstraints.idxname) 
       = row (sysindexes.owner, sysindexes.idxname) 

这是一个等效的on条款,效果很好:

-- causes no issues
from
  sysconstraints 
    join systables 
      on sysconstraints.tabid = systables.tabid 
    join sysindexes 
      on sysconstraints.owner = sysindexes.owner
     and sysconstraints.idxname = sysindexes.idxname

这是一个使用row()子句中的where谓词的等效查询,它也有效:

-- causes no issues
from
  sysconstraints 
    join systables 
      on sysconstraints.tabid = systables.tabid 
    cross join sysindexes 
where row (sysconstraints.owner, sysconstraints.idxname) 
    = row (sysindexes.owner, sysindexes.idxname) 

结论:请勿在Informix ROW()子句中使用JOIN .. ON谓词。它会使您的数据库崩溃