norm
norm copied to clipboard
RETURNING BUG is back
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
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.