Postgres获取带列的表架构
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Postgres获取带列的表架构相关的知识,希望对你有一定的参考价值。
Get table schema with columns via sql.
SELECT ordinal_position, column_name, data_type, is_nullable, description.description AS comment FROM information_schema.columns COLUMNS LEFT JOIN pg_class class ON (COLUMNS.table_name = class.relname) LEFT JOIN pg_description description ON (class.oid = description.objoid) LEFT JOIN pg_attribute attrib ON (class.oid = attrib.attrelid AND COLUMNS.column_name = attrib.attname AND attrib.attnum = description.objsubid) WHERE TABLE_NAME='{$tableName}' GROUP BY ordinal_position, column_name, data_type, is_nullable, description.description
以上是关于Postgres获取带列的表架构的主要内容,如果未能解决你的问题,请参考以下文章