From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: shandeep2846@gmail.com
Subject: Get original view definition without modification
Date: Fri, 29 May 2020 05:55:57 +0000
Message-ID: <159073175748.7034.16685684549743853062@wrigleys.postgresql.org> (raw)
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/9.5/rules-views.html
Description:
I am looking a way to get exact view definition, for ex :
CREATE TABLE t1(id int,name varchar);
INSERT INTO t1 values(1,'n1'),(2,'n2');
CREATE VIEW v2 AS SELECT * FROM t1 WHERE name = 'n1';
But when i checked the definition in postgresql DB(9.5) in pg_views
table, it is getting modified in the below way :
postgres=# select * from pg_views where schemaname = 'sc1' and viewname
= 'v2';
schemaname | viewname | viewowner | definition
------------+----------+-----------+-----------------------------------------
sc1 | v2 | postgres | SELECT t1.id,
+
| | | t1.name
+
| | | FROM sc1.t1
+
| | | WHERE ((t1.name)::text =
'n1'::text);
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)
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: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, shandeep2846@gmail.com
Subject: Re: Get original view definition without modification
In-Reply-To: <159073175748.7034.16685684549743853062@wrigleys.postgresql.org>
* 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