markstos/CGI--Uploader — pull request #1 by moltar (2012-01-25 19:50:16+00:00)
Title: It is wrong to issue an INSERT without providing an ID, when using NEXTVAL()

It is wrong to issue an INSERT without providing an ID, when using NEXTVAL() to obtain it.

This definitely breaks on 9.0, however it did work on 8.0. I don't have time to test all of the setups, but I spent almost an entire day hunting this bug, and this fix works.

I also consulted with people on #posthresql and they confirmed that such INSERT shall not happen. Either (1) INSERT, then get ID via currval(); (2) INSERT ... RETURNING, or (3) NEXTVAL(), then INSERT INTO table (id, ...) VALUES ($id, ...).