Re: [HACKERS] idea: storing view source in system catalogs

2008-07-14 Thread Bruce Momjian
Added to TODO: * Improve ability to modify views via ALTER TABLE http://archives.postgresql.org/pgsql-hackers/2008-05/msg00691.php --- Robert Haas wrote: > I think the real problem here is that P

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-25 Thread Florian Pflug
Merlin Moncure wrote: On Wed, May 21, 2008 at 4:39 AM, Andreas Pflug <[EMAIL PROTECTED]> wrote: Not the whole reason. To get a view definition that is more readable, the pretty_bool option of pg_get_viewdef already does some newline and indent formatting. Not the initial formatting, but Good Eno

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-22 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > "Tom Lane" <[EMAIL PROTECTED]> writes: >> Yeah. The current restrictions were set when CREATE OR REPLACE VIEW >> was first implemented, and at that time we didn't have very much >> ALTER TABLE capability at all; the view restrictions mirror what we >> co

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-22 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > "Robert Haas" <[EMAIL PROTECTED]> writes: >> I think the real problem here is that PostgreSQL is very finicky about >> what operations you can perform on a view. If I have a table foo and >> I define a view bar that uses foo and a view baz that uses bar, I

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-22 Thread Tom Lane
"Robert Haas" <[EMAIL PROTECTED]> writes: > I think the real problem here is that PostgreSQL is very finicky about > what operations you can perform on a view. If I have a table foo and > I define a view bar that uses foo and a view baz that uses bar, I can > add a column to foo without a problem,

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-21 Thread Robert Haas
I think the real problem here is that PostgreSQL is very finicky about what operations you can perform on a view. If I have a table foo and I define a view bar that uses foo and a view baz that uses bar, I can add a column to foo without a problem, and, similarly, I can also drop or alter a column

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-21 Thread Merlin Moncure
On Wed, May 21, 2008 at 7:56 AM, Hannu Krosing <[EMAIL PROTECTED]> wrote: > On Wed, 2008-05-21 at 10:40 +0200, Andreas Pflug wrote: >> Florian Pflug wrote: >> > >> > But maybe you could store the whitespace appearing before (or after?) >> > a token in the parse tree that is stored for a view. That

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-21 Thread Hannu Krosing
On Wed, 2008-05-21 at 10:40 +0200, Andreas Pflug wrote: > Florian Pflug wrote: > > > > But maybe you could store the whitespace appearing before (or after?) > > a token in the parse tree that is stored for a view. That might not > > allow reconstructing the *precise* statement, but at least the

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-21 Thread Merlin Moncure
On Wed, May 21, 2008 at 4:39 AM, Andreas Pflug <[EMAIL PROTECTED]> wrote: > Not the whole reason. To get a view definition that is more readable, the > pretty_bool option of pg_get_viewdef already does some newline and indent > formatting. Not the initial formatting, but Good Enough (TM), I believe

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-21 Thread Andreas Pflug
Florian Pflug wrote: But maybe you could store the whitespace appearing before (or after?) a token in the parse tree that is stored for a view. That might not allow reconstructing the *precise* statement, but at least the reconstructed statement would preserve newlines and indention - which

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-20 Thread Florian Pflug
David Fetter wrote: On Tue, May 20, 2008 at 02:03:17PM -0400, Merlin Moncure wrote: I wonder if there is any merit to the idea of storing the 'create view' statement that created the view in an appropriate place. There are basically two reasons for this: +1 for DDL in general, including the or

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-20 Thread Tom Lane
"Merlin Moncure" <[EMAIL PROTECTED]> writes: > I wonder if there is any merit to the idea of storing the 'create > view' statement that created the view in an appropriate place. No, there isn't. As counterexamples look at pg_constraint.consrc and pg_attrdef.adsrc, both of which were mistakes from

Re: [HACKERS] idea: storing view source in system catalogs

2008-05-20 Thread David Fetter
On Tue, May 20, 2008 at 02:03:17PM -0400, Merlin Moncure wrote: > I wonder if there is any merit to the idea of storing the 'create > view' statement that created the view in an appropriate place. > There are basically two reasons for this: +1 for DDL in general, including the original CREATE and

[HACKERS] idea: storing view source in system catalogs

2008-05-20 Thread Merlin Moncure
I wonder if there is any merit to the idea of storing the 'create view' statement that created the view in an appropriate place. There are basically two reasons for this: *) preserve initial formatting, etc. Database functions when viewed with \df+ in psql appear nice and clean as I wrote them.