fordfrog / apgdiff

Another PostgreSQL Diff Tool
http://www.apgdiff.com
MIT License
355 stars 138 forks source link

Fix GRANT SEQUENCE, ALTER VIEW OWNER, GRANT(cols) errors #227

Closed steve-chavez closed 5 years ago

steve-chavez commented 6 years ago

The diffing of sequence privileges had GRANT ON/REVOKE ALL ON on TABLE instead of SEQUENCE.

ALTER .. OWNER was only working for tables and not views.

steve-chavez commented 6 years ago

Added another fix for a couple of errors I found on table/view privileges on specific columns:

-- original.sql

create table items(id integer, name text);
create view items_view as select id from items;

-- new.sql

create table items(id integer, name text);
create view items_view as select id from items;
grant select(id, name), insert(name), update on items_view to admin;

-- diff.sql

GRANT SELECT, INSERT, UPDATE ON TABLE items_view TO admin;

i.e. When having a last privilege without cols the previous col privileges get ignored.

-- original.sql

create table items(id integer, name text);
create view items_view as select id from items;

-- new.sql

create table items(id integer, name text);
create view items_view as select id from items;
grant select(id, name), insert, update(name) on items_view to admin;

-- diff.sql
-- gives java.lang.NullPointerException

When having a privilege without cols followed by a privilege with cols the exception is produced.

valoricDe commented 5 years ago

Closing, coz merged in #245