apgdiff icon indicating copy to clipboard operation
apgdiff copied to clipboard

Uncaught Java Exception (on RLS?)

Open gregtzar opened this issue 7 years ago • 1 comments

I am getting an uncaught Java exception. I did not see a debug output option in the man page for apgdiff otherwise I would try to post more meaningful context for the error. I don't know what it's choking on, but I could take an educated guess. We just added Row Level Security policies to our schema in Postgresql 9.5. Apgdiff was working fine up until then and that is about the only change we made.

Here is an example of the policy:

ALTER TABLE whatever ENABLE ROW LEVEL SECURITY;

CREATE POLICY whatever_tenant ON whatever
	USING (tenant_id = get_tenant());

Here is the error:

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 62
	at java.lang.String.substring(String.java:1907)
	at cz.startnet.utils.pgdiff.parsers.Parser.expect(Parser.java:86)
	at cz.startnet.utils.pgdiff.parsers.Parser.expect(Parser.java:47)
	at cz.startnet.utils.pgdiff.parsers.AlterTableParser.parse(AlterTableParser.java:112)
	at cz.startnet.utils.pgdiff.loader.PgDumpLoader.loadDatabaseSchema(PgDumpLoader.java:180)
	at cz.startnet.utils.pgdiff.loader.PgDumpLoader.loadDatabaseSchema(PgDumpLoader.java:236)
	at cz.startnet.utils.pgdiff.PgDiff.createDiff(PgDiff.java:33)
	at cz.startnet.utils.pgdiff.Main.main(Main.java:39)

gregtzar avatar Feb 17 '17 21:02 gregtzar

@gtczap check out the PR I just made see if it helps. Let me know if you need me to build you a jar

chadfurman avatar Jun 27 '17 07:06 chadfurman