Preserving formatting and comments in a VIEW definition

Started by Robert Jamesabout 11 years ago2 messagesgeneral
Jump to latest
#1Robert James
srobertjames@gmail.com

When I save a VIEW, Postgres seems to convert it to a different
format, functionally equivalent but unrecognizable (whitespace,
comments, adds lots of casts, etc.)

Is there any simple way to preserve my original code?

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Robert James (#1)
Re: Preserving formatting and comments in a VIEW definition

Robert James <srobertjames@gmail.com> writes:

When I save a VIEW, Postgres seems to convert it to a different
format, functionally equivalent but unrecognizable (whitespace,
comments, adds lots of casts, etc.)

Is there any simple way to preserve my original code?

The usual suggestion is to keep your SQL code in an SCM repo, somewhere
outside the database. Postgres itself saves views as parse trees, so
there's no way it will ever remember whitespace or comments.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general