Re: Postgresql - Inline comment in VIEW Sql definition

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: vikram singh chandel <vikramschandel(at)outlook(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Postgresql - Inline comment in VIEW Sql definition
Date: 2016-04-04 15:22:33
Message-ID: CAHyXU0z63xdE=ufdD0kTkjQZLp8aUhed0N-ShruUD8SdL31vQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, Apr 4, 2016 at 9:10 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> vikram singh chandel <vikramschandel(at)outlook(dot)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 is saved.
>
>> However in our application we have designed one process which uses the tags that we mention within comments as part of CREATE VIEW definition. Things were going on good in Oracle database as it stored inline comments also. During migration we are unable to port one of our functionality which have dependency on comments in View in Postgres it didn't save the 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Kevin Grittner 2016-04-04 21:34:35 Re: unrecognized configuration parameter "autocommit"
Previous Message Tom Lane 2016-04-04 14:10:06 Re: Postgresql - Inline comment in VIEW Sql definition