MySQL will accept NULL to an auto increment column and insert the last value. So you could presumably use
(Using the code from this SO answer, where st is a preparedStatement)
st.setNull(1, java.sql.Types.NULL)
I'm trying to figure out how you do the same with Postgresql, where you cannot use NULL, but must use DEFAULT instead:
INSERT INTO serial_table (id) VALUES(NULL)
Does something like this exist?
st.setDefault(1, java.sql.Types.DEFAULT)
Or
st.setObject(1, "DEFAULT")
I assume I can't just use the string "DEFAULT".
EDIT:
To clarify, this is a testing table defined as such:
CREATE TABLE serial_table (
id SERIAL NOT NULL PRIMARY KEY
);
So I can't just skip the column to let Postgresql handle it
INSERT INTO serial_table VALUES()
ERROR: syntax error at or near ")"
LINE 1: INSERT INTO serial_table VALUES();
^
The future returned an exception of type: java.lang.RuntimeException, with message: ERROR: null value in column "id" of relation "serial_table" violates not-null constraint