Return to Snippet

Revision: 37379
at December 9, 2010 06:08 by djmornyc


Initial Code
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

Initial URL

                                

Initial Description
Get table schema with columns via sql.

Initial Title
Postgres get table schema with columns

Initial Tags
sql, table

Initial Language
SQL