fordfrog / apgdiff

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

Return value of "cz.startnet.utils.pgdiff.schema.PgSchema.getRelation(String)" is null #283

Open dan-aksenov opened 3 years ago

dan-aksenov commented 3 years ago

Running on MacOS: java -jar apgdiff-2.6.0.jar one.sql another.sql have:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "cz.startnet.utils.pgdiff.schema.PgRelation.addRule(cz.startnet.utils.pgdiff.schema.PgRule)" because the return value of "cz.startnet.utils.pgdiff.schema.PgSchema.getRelation(String)" is null
    at cz.startnet.utils.pgdiff.parsers.CreateRuleParser.parse(CreateRuleParser.java:74)
    at cz.startnet.utils.pgdiff.loader.PgDumpLoader.loadDatabaseSchema(PgDumpLoader.java:275)
    at cz.startnet.utils.pgdiff.loader.PgDumpLoader.loadDatabaseSchema(PgDumpLoader.java:311)
    at cz.startnet.utils.pgdiff.PgDiff.createDiff(PgDiff.java:35)
    at cz.startnet.utils.pgdiff.Main.main(Main.java:39)

Java version:

➜  ~ java -version
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment Homebrew (build 16.0.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 16.0.1+0, mixed mode, sharing)
m-grigas commented 3 years ago

I am having a similar issue:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "cz.startnet.utils.pgdiff.schema.PgTable.getConstraint(String)" because the return value of "cz.startnet.utils.pgdiff.schema.PgSchema.getTable(String)" is null
    at cz.startnet.utils.pgdiff.parsers.CommentParser.parseConstraint(CommentParser.java:96)
    at cz.startnet.utils.pgdiff.parsers.CommentParser.parse(CommentParser.java:36)
    at cz.startnet.utils.pgdiff.loader.PgDumpLoader.loadDatabaseSchema(PgDumpLoader.java:260)
    at cz.startnet.utils.pgdiff.loader.PgDumpLoader.loadDatabaseSchema(PgDumpLoader.java:311)
    at cz.startnet.utils.pgdiff.PgDiff.createDiff(PgDiff.java:35)
    at cz.startnet.utils.pgdiff.Main.main(Main.java:39)

Java version:

java version "16.0.1" 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)