0

I'm not a DBA but seem to recall that there was a SQL database that stored column labels (preferred column headings that can be printed on reports). Does Postgres support labels such as these?

1
2

You might be refereing to catalog level comments, which can be used to get a description of any table and or column in the database.

Those are created using:

COMMENT ON TABLE yourtable IS 'A good description';
COMMENT ON COLUMN yourtable.yourcolumn IS 'Column desc';

To query those, you can use this kind of query:

SELECT c.table_schema,c.table_name,c.column_name,pgd.description
FROM pg_catalog.pg_statio_all_tables as st
inner join pg_catalog.pg_description pgd on (pgd.objoid=st.relid)
inner join information_schema.columns c on (pgd.objsubid=c.ordinal_position
and  c.table_schema=st.schemaname and c.table_name=st.relname)
where table_name = 'yourtablename'

Beware however that this cannot be localized.

1

No. (You may be thinking of MS Access.)

But you can easily substitute with a VIEW. Like in almost any RDBMS.

1
  • Thanks. I was hoping that the labels could be read along with the column values to maintain label consistency. – Linda Jan 10 '14 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.