Mapping view columns to their source columns

From: Matt Andrews <mattandrews(at)massey(dot)com(dot)au>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Mapping view columns to their source columns
Date: 2019-09-25 00:39:30
Message-ID: CAPeDGQ6KrAL8+8myKWorcj02G05otgMrSgOzi9axemaZf=cScA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm trying to map view columns to their source columns using the system
catalogs and information schema, but not having much luck. It's easy to
determine which columns a view *depends *on, but not how those columns are
mapped to the columns of the view. It seems like the only way to do is this
is to somehow query the pg_node_tree in pg_rewrite.ev_call.

I'm trying to do this to provide meta data for an API. For example:
- a database design's API is implemented via functions
- a function returns a setof a particular view
- the web server that is serving the data might want to manipulate the
returned data based on the types/constraints of the underlying columns of
the view.

It seems like mapping view columns to their source columns should be
something that's been done before. Is it possible?

Matt Andrews

0400 990 131

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Gierth 2019-09-25 02:46:25 Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.
Previous Message Paul McGarry 2019-09-25 00:12:17 Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.