Preserving view source code - Mailing list pgsql-general

From Thomas Kellerer
Subject Preserving view source code
Date
Msg-id ff2nae$dan$1@ger.gmane.org
Whole thread Raw
Responses Re: Preserving view source code  (Richard Huxton <dev@archonet.com>)
List pgsql-general
Hello,

when I create a view, e.g.:

CREATE VIEW my_view
AS
SELECT col1,
        col2,
        col3
FROM mytable;

And I later retrieve the view's source using "SELECT definition FROM pg_view",
the source I supplied has been altered by Postgres.

The formatting has been removed completely and PG actually re-wrote the query.
For the above example I would get:

SELECT mytable.col1, mytable.col2, mytable.col3 FROM mytable

(all in one line)

Is there a way to tell PG _not_ to alter my SQL, so I can retrieve the same (or
at least a very similar) version of the original statement?

For procedures this is already the case, so I wonder why the view code is
altered that much.

Regards
Thomas

pgsql-general by date:

Previous
From: "Michael Guiard"
Date:
Subject: Re: slow request
Next
From: brian
Date:
Subject: Re: problem with a column of type timestamp