yamltodb 0.7.1 unsuccessfully attempts to alter the type of columns in views. #90

Open
squareproton opened this Issue Mar 19, 2014 · 1 comment

Comments

Projects
None yet
2 participants
DROP SCHEMA IF EXISTS test_view CASCADE;
CREATE SCHEMA test_view;
SET search_path TO test_view;

CREATE VIEW "one" AS SELECT 1::int;

dbtoyaml produces

...
schema test_view:
  owner: unit
  view one:
    definition: ' SELECT 1 AS int4;'
    owner: unit

Change view. DROP VIEW "one"; CREATE VIEW "one" AS SELECT 'one'::text;.

Execute yamltodb using yml as before yeilds

CREATE OR REPLACE VIEW test_view.one AS
    SELECT 1 AS int4;

Which won't work as postgres considers it impossible to alter the type of a column in already existing view. I've been lucky so far in that just dropping the view and then recreating it has been possible every time. I expect things to get ugly when other objects depend on the view.

Pyrseas 0.7.1, postgres 9.2.6

squareproton changed the title from yamltodb 0.7.1unsuccessfully attempts to alter the type of columns in views. to yamltodb 0.7.1 unsuccessfully attempts to alter the type of columns in views. Mar 19, 2014

jmafc added the yamltodb label Mar 19, 2014

Owner

jmafc commented Mar 19, 2014

Changes to views (as well as changes to foreign key constraints) is one of the weak spots of yamltodb currently. It should be possible to detect the problem in your test case and issue the DROP/CREATE instead, but as you point out it gets ugly when there are other dependencies. Much remains to be done in this area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment