Re: Preserving formatting and comments in a VIEW definition

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert James <srobertjames(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Preserving formatting and comments in a VIEW definition
Date: 2015-03-15 16:51:43
Message-ID: 27753.1426438303@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Robert James <srobertjames(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert James 2015-03-16 04:05:48 Re: How do I calculate the sum of a field filtered by multiple windows defined by another field?
Previous Message Robert James 2015-03-15 16:35:04 Preserving formatting and comments in a VIEW definition