Related:
For query writing purposes I want to have nice short actual column names.
However, from my actual data source, I have an extremely long "canonical" name for each field. (This was the column name in the source.)
When showing my query results, I would like to show these long column names.
How can I do this?
I considered a couple ways of approaching this:
- I could COMMENT ON each column, which would at least store the long names directly in the table definition, but this wouldn't show the comments with each query result. (Unless there's some way to do that...?)
- I could make a big column alias block of code that I could copy and paste for each query, but that would only work if I'm returning ALL the columns, which isn't likely in most cases.
- I could try some fancy magic with the information schema (or system tables) and use PL/pgSQL to run every query so it gives the desired column names. (I wouldn't know how to approach this, actually, though I have a decent grasp of PL/pgSQL.)
- There must be some better way I haven't thought of...can you help me here?