fordfrog / apgdiff

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

Null Pointer Exception using trigger #272

Open cederache opened 4 years ago

cederache commented 4 years ago

Hi everyone, I have an issue using apgdif 2.0.6 with the creation of a trigger.

All the previous trigger did not cause the issue except for this one.

The issue can easily be created using the command : java -jar apgdiff-2.6.0.jar prod.sql dev.sql

With dev.sql :

CREATE TABLE test  
(  
id uuid DEFAULT public.gen_random_uuid() NOT NULL,  
name text NOT NULL  
);

CREATE FUNCTION trigger_test() RETURNS trigger  
LANGUAGE plpgsql SECURITY DEFINER  
AS $$  
begin  
RAISE LOG 'test';  
return null;  
end;  
$$;

CREATE TRIGGER test_write INSTEAD OF INSERT OR UPDATE OR DELETE ON test FOR EACH ROW EXECUTE PROCEDURE trigger_test();

And prod.sql is an empty file

cederache commented 4 years ago

Here is the missing logs :

Exception in thread "main" java.lang.NullPointerException
at cz.startnet.utils.pgdiff.PgDiffTriggers.getEnablerOrDisableTriggers(PgDiffTriggers.java:222)
at cz.startnet.utils.pgdiff.PgDiffTriggers.disableOrEnableTriggers(PgDiffTriggers.java:256)
at cz.startnet.utils.pgdiff.PgDiff.updateSchemas(PgDiff.java:321)
at cz.startnet.utils.pgdiff.PgDiff.diffDatabaseSchemas(PgDiff.java:144)
at cz.startnet.utils.pgdiff.PgDiff.createDiff(PgDiff.java:46)
at cz.startnet.utils.pgdiff.Main.main(Main.java:39)
nphard commented 4 years ago

I have the same problem

d1maxa commented 4 years ago

Hi guys, this problem looks solved in https://github.com/fordfrog/apgdiff/issues/255 already