GBase 8s
适配迁移
问答
【GBase版本】:GBase8sV8.8_TL_3.5.1_3X2_x86_64
【问题描述】*:
问题1:如何获取表的主键约束信息 问题2:如何查询索引列
有对应文档可参考吗
热门帖子
- 12025-12-01浏览数:182764
- 22023-05-09浏览数:25062
- 42023-09-25浏览数:18526
- 52020-05-11浏览数:17529
【GBase版本】:GBase8sV8.8_TL_3.5.1_3X2_x86_64
【问题描述】*:
问题1:如何获取表的主键约束信息 问题2:如何查询索引列
有对应文档可参考吗
SELECT t.tabname, c.constrtype, c.constrname
FROM sysconstraints c, systables t
WHERE c.tabid = t.tabid;
P主键,U唯一,C检查,N非空,R外键
索引列:
select unique
t.tabname
, i.idxname
, i.idxtype
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part1)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part2)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part3)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part4)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part5)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part6)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part7)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part8)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part9)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part10)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part11)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part12)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part13)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part14)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part15)
, (select c.colname from syscolumns c where c.tabid = i.tabid and c.colno = i.part16)
from sysindexes i , systables t
where i.tabid = t.tabid;