I would like PostegreSQL to relax a bit. Every time I want to change a column used in a view, it seems I have to drop the view, change the field and then recreate the view. Can I waive the extra protection and just tell PostgreSQL to let me change the field and then figure out the adjustment to the view?
Clarification: I understand what a view is. In fact, it's because the view is like a subquery that I wish I could just change the underlying tables and have the view pick up the change.
Let's say I have the following:
CREATE TABLE monkey
(
"name" character varying(50) NOT NULL,
)
CREATE OR REPLACE VIEW monkey_names AS
SELECT name
FROM monkey
I really just want to do the following in a migration script without having to drop and recreate the view.
ALTER TABLE monkey ALTER COLUMN "name" character varying(100) NOT NULL
ALTER VIEWstatement in PostgreSQL. You can't change the view's defining query, but there are other auxiliary attributes.