Mapping view columns to their source columns - Mailing list pgsql-general

From Matt Andrews
Subject Mapping view columns to their source columns
Date
Msg-id CAPeDGQ6KrAL8+8myKWorcj02G05otgMrSgOzi9axemaZf=cScA@mail.gmail.com
Whole thread Raw
Responses Re: Mapping view columns to their source columns
List 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




pgsql-general by date:

Previous
From: Paul McGarry
Date:
Subject: Re: How to get timezone offset in timestamp with time zone AT TIMEZONE output.
Next
From: Andrew Gierth
Date:
Subject: Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.