Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RETURNING BUG is back #39

Open
ZZerog opened this issue May 14, 2019 · 1 comment
Open

RETURNING BUG is back #39

ZZerog opened this issue May 14, 2019 · 1 comment

Comments

@ZZerog
Copy link

ZZerog commented May 14, 2019

Hi, RETURNING * bug in Postgres driver is back.

Try add TRIGGER.

CREATE TRIGGER <trigger_name>AFTER INSERT OR DELETE OR UPDATE ON <table_name> FOR EACH ROW EXECUTE PROCEDURE <function_name> ()

the error: Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "RETURNING"

My opinion is get back the hack in the execute() method. Something as:

String lowerSql = sql.toLowerCase();
if (lowerSql.contains("create trigger")) { //better regex
	state = localCon.prepareStatement(sql);
} else {
	state = localCon.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
}

norm - 0.8.3
postgresql - 42.2.5

@ccleve
Copy link
Member

ccleve commented May 20, 2019

I've done a general rewrite of generated key handling. It's in the master branch. Have a look. Bottom line: RETURN_GENERATED_KEYS is never specified unless you call the new method .generatedKeyReceiver() or insert(). Let me know if it works and I'll do a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants