Home:ALL Converter>PostgreSQL preserve comments

PostgreSQL preserve comments

Ask Time:2015-11-23T07:42:46         Author:digimetic

Json Formatter

I'm relatively new to the PostgreSQL environment, coming from years of experience in SQLServer. Not sure if this is an environmental thing with pgAdmin or just PostgreSQL itself but I'm wondering how to preserve comments in saved SQL statements.

For example, say you create a view like

create view MyView
as
/*
   comment1
   comment2
   ...
*/
select    col1
          ,col2
          --,col3    -- comment line 
from      tbl1
where     1 = 1;

and then highlight this created view in pgAdmin (in the object browser), none of those comments appear. You basically see something like

create or replace view myview as
select    col1,
          col2
from      tbl1
where     1 = 1;

As you can see, the comments have been removed. Is this a config setting, am I "doing it wrong"?

Many thanks,

B

Author:digimetic,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/33861647/postgresql-preserve-comments
yy