column information from view

2018-09-15 Thread Seb
Hello, I'm trying to generate a table with information from a temporary view that simply selects a subset of columns from a persistent view in a given schema. The persistent view joins a number of tables with columns that may or may not have a description entered. Here's my attempt at listing th

Re: column information from view

2018-09-14 Thread Sebastian P . Luque
On Fri, 14 Sep 2018 18:29:27 -0400, Tom Lane wrote: > "Sebastian P. Luque" writes: >> Tom Lane wrote: >>> Personally, I'd probably write it something like this: >>> select pa.attnum, pa.attname, col_description(pa.attrelid, >>> pa.attnum) from pg_attribute pa, pg_attribute ta where pa.attrelid

Re: column information from view

2018-09-14 Thread Adrian Klaver
On 9/14/18 3:17 PM, Sebastian P. Luque wrote: On Fri, 14 Sep 2018 14:47:07 -0700, Adrian Klaver wrote: SELECT cols.ordinal_position, cols.column_name, col_description(cl.oid, cols.ordinal_position::INT) FROM pg_class cl, information_schema.columns cols WHERE cols.table_catalog='aquaculture'

Re: column information from view

2018-09-14 Thread Tom Lane
"Sebastian P. Luque" writes: > Tom Lane wrote: >> Personally, I'd probably write it something like this: >> select pa.attnum, pa.attname, col_description(pa.attrelid, pa.attnum) >> from pg_attribute pa, pg_attribute ta where pa.attrelid = >> 'persistent_view'::regclass and ta.attrelid = >> 'temp

Re: column information from view

2018-09-14 Thread Sebastian P . Luque
On Fri, 14 Sep 2018 17:52:28 -0400, Tom Lane wrote: > Umm ... why are you doing cols.table_name = 'persistent_view' and not > cols.table_name = 'temporary_view' ? I should have pointed out that the column descriptions are all NULL in the temporary view, and I'd like to pull them from the persist

Re: column information from view

2018-09-14 Thread Sebastian P. Luque
On Fri, 14 Sep 2018 14:47:07 -0700, Adrian Klaver wrote: > SELECT cols.ordinal_position, cols.column_name, > col_description(cl.oid, cols.ordinal_position::INT) > FROM pg_class cl, information_schema.columns cols > WHERE cols.table_catalog='aquaculture' AND cols.table_schema ilike > 'pg_temp%'

Re: column information from view

2018-09-14 Thread Tom Lane
"Sebastian P. Luque" writes: > Here's my attempt at listing the temporary view's columns and respective > descriptions: > SELECT cols.ordinal_position, cols.column_name, > col_description(cl.oid, cols.ordinal_position::INT) > FROM pg_class cl, information_schema.columns cols > WHERE cols.table_

Re: column information from view

2018-09-14 Thread Adrian Klaver
On 9/14/18 2:35 PM, Sebastian P. Luque wrote: Hello, I'm trying to generate a table with information on columns from a temporary view that simply selects a subset of columns from a persistent view in a given schema. The persistent view joins a number of tables with columns that may or may not h

column information from view

2018-09-14 Thread Sebastian P. Luque
Hello, I'm trying to generate a table with information on columns from a temporary view that simply selects a subset of columns from a persistent view in a given schema. The persistent view joins a number of tables with columns that may or may not have a description entered. I need a table with