Re: Preserving view source code

From: Richard Huxton <dev(at)archonet(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Preserving view source code
Date: 2007-10-16 16:59:22
Message-ID: 4714EDEA.60709@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thomas Kellerer wrote:
> Hello,
>
> when I create a view, e.g.:

> 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:

> 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.

The body of a function is just text, so what you put in is what you get out.

The view definition is presumably in the form of a parse-tree or some
such, so what you get back is a human-readable form of that rather than
what you type at the keyboard.

It's the same with pg_dump's interpretation of your table definitions -
you don't get the formatting nor even the "shape" of your definition I'm
afraid.

What are you trying to do that requires the original definition?

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2007-10-16 17:09:34 Re: improvement proposition
Previous Message Laurent Duperval 2007-10-16 16:46:42 Re: 8.2.3: Server crashes on Windows using Eclipse/Junit