Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jegau-0005VG-Uk for pgsql-docs@arkaria.postgresql.org; Fri, 29 May 2020 15:06:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jegat-0005o7-PQ for pgsql-docs@arkaria.postgresql.org; Fri, 29 May 2020 15:06:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jegat-0005nR-Jn for pgsql-docs@lists.postgresql.org; Fri, 29 May 2020 15:06:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jegar-0007LS-EZ for pgsql-docs@lists.postgresql.org; Fri, 29 May 2020 15:06:47 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 04TF6gNn005344; Fri, 29 May 2020 11:06:42 -0400 From: Tom Lane To: shandeep2846@gmail.com cc: pgsql-docs@lists.postgresql.org Subject: Re: Get original view definition without modification In-reply-to: <159073175748.7034.16685684549743853062@wrigleys.postgresql.org> References: <159073175748.7034.16685684549743853062@wrigleys.postgresql.org> Comments: In-reply-to PG Doc comments form message dated "Fri, 29 May 2020 05:55:57 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10394.1590764802.1@sss.pgh.pa.us> Date: Fri, 29 May 2020 11:06:42 -0400 Message-ID: <10395.1590764802@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Doc comments form 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