Re: I incrementally altered my database into a state where backups couldn't be restored. - Mailing list pgsql-bugs

From Gregory Stark
Subject Re: I incrementally altered my database into a state where backups couldn't be restored.
Date
Msg-id 873avrflih.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: I incrementally altered my database into a state where backups couldn't be restored.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Gregory Stark <stark@enterprisedb.com> writes:
>> That does really suck. But I'm not sure what we can do about it. There's no
>> SQL which is entirely equivalent to the resulting view.
>
> If we were to do anything about it, I think it would have to be to
> forbid the original ALTER.  But I don't see any good way to detect
> the situation, either.

Hm, we could call pg_get_viewdef() on dependent views and then verify that the
resulting view compiles without error.

For bonus points we could verify that it produces the same parsed view and
throw warning if it doesn't. That would give us a warning if you have a view
with natural joins which changed meanings.

I'm not sure it's worth that much extra work on every ALTER TABLE though. I
suppose pg_dump() could have an option to check these things itself but by
that point it's too late to do anything about it.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's Slony Replication support!

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: I incrementally altered my database into a state where backups couldn't be restored.
Next
From: Heikki Linnakangas
Date:
Subject: Re: I incrementally altered my database into a state where backups couldn't be restored.