Re: Postgresql - Inline comment in VIEW Sql definition - Mailing list pgsql-novice

From Merlin Moncure
Subject Re: Postgresql - Inline comment in VIEW Sql definition
Date
Msg-id CAHyXU0z63xdE=ufdD0kTkjQZLp8aUhed0N-ShruUD8SdL31vQw@mail.gmail.com
Whole thread Raw
In response to Re: Postgresql - Inline comment in VIEW Sql definition  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
On Mon, Apr 4, 2016 at 9:10 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> vikram singh chandel <vikramschandel@outlook.com> writes:
>> PostgreSQL does not allow to strore inline comments in view's SQL definition, because the CREATE VIEW statement is
parsed,and then analyzed to see what table and other database objects are referenced, and then the analyzed parse-tree
issaved. 
>
>> However in our application we have designed one process which uses the tags that we mention within comments as part
ofCREATE VIEW definition. Things were going on good in Oracle database as it stored inline comments also. During
migrationwe are unable to port one of our functionality which have dependency on comments in View in Postgres it didn't
savethe comments. 
>
>> Do we have anyway to get the actual VIEW text in Postgres db.
>
> No.  You might be able to achieve something more or less equivalent
> using COMMENT ON to attach comments to the view's columns.

You can also wrap view creation in a function -- functions preserve
inline comments.

Generally though with postgres you want to write all DDL into scripts
rather than let the database manage the code.

merlin


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Postgresql - Inline comment in VIEW Sql definition
Next
From: Kevin Grittner
Date:
Subject: Re: unrecognized configuration parameter "autocommit"