在MYSQL中,查询用户表信息和表字段信息,在mysql的 information_schema库中tables 表和columns表中进行定义,我们可以直接查询。
select table_name tableName , table_rows tableRows from information_schema.tables WHERE table_schema=?
select table_name tableName ,column_name columnName, ordinal_position ordinalPosition, data_type dataType, column_type columnType,column_key columnKey from information_schema.columns where table_name in (:tableNames)
但是在OpenGauss中,我们不能直接查询这些信息,需要根据openGauss提供的一些视图自己组装SQL
information_schema.tables 表信息
information_schema.columns 表列信息
information_schema.key_column_usage 约束对应字段信息
information_schema.table_constraints 表约束信息
select table_name tableName from information_schema.tables WHERE table_schema=? and TABLE_TYPE='BASE TABLE';
selec