pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: shandeep2846@gmail.com
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: Get original view definition without modification
Date: Fri, 29 May 2020 11:06:42 -0400
Message-ID: <10395.1590764802@sss.pgh.pa.us> (raw)
In-Reply-To: <159073175748.7034.16685684549743853062@wrigleys.postgresql.org>
References: <159073175748.7034.16685684549743853062@wrigleys.postgresql.org>

PG Doc comments form <noreply@postgresql.org> writes:
> I am looking a way to get exact view definition, for ex :
> ...
> I am fine with adding tablename before columnname but i don't want the extra
> '::text' part. Is there anyway to achieve this(like any other system table i
> can query from to get original definition)

No, Postgres only saves a "compiled" form of a view.  Storing the original
text would have its own pitfalls, eg what if you rename a table or column
mentioned in the view?  (Also, the SQL standard has some requirements that
would be difficult to meet otherwise.)

If you really want the original text, best bet is to keep your schema
creation commands in a VCS or the like, outside the database.

			regards, tom lane





view thread (2+ messages)

Message-ID: <10395.1590764802@sss.pgh.pa.us>
Permalink:  ../10395.1590764802@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10395.1590764802@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, shandeep2846@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: Get original view definition without modification
  In-Reply-To: <10395.1590764802@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox