Preserving view source code

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Preserving view source code
Date: 2007-10-16 16:02:22
Message-ID: ff2nae$dan$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message brian 2007-10-16 16:27:50 Re: problem with a column of type timestamp
Previous Message Rob Shepherd 2007-10-16 15:21:00 variable in COPY <table> TO variable