Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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

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

share|improve this answer
    
Thanks. I was hoping that the labels could be read along with the column values to maintain label consistency. –  Linda Jan 10 at 1:43

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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