At some point, possibly due to a change in Opaleye, insertion of default values (using unsafeDefault) stopped working in Rel8.
In general, PostgreSQL only allows insertion of default values in insert statements that have the form INSERT INTO table VALUES (DEFAULT). The way Opaleye typically generates SQL, the Rel8 equivalent to that code would come out looking more like INSERT INTO table SELECT * FROM (VALUES (DEFAULT)) q. Because the VALUES is wrapped in a SELECT, the DEFAULT becomes invalud PostgreSQL syntax.
To get around this, we special case VALUES when generating SQL for INSERT statements. However, something in the Opaleye representation changed and this special case was no longer firing. This commit fixes that.
At some point, possibly due to a change in Opaleye, insertion of default values (using
unsafeDefault
) stopped working in Rel8.In general, PostgreSQL only allows insertion of default values in insert statements that have the form
INSERT INTO table VALUES (DEFAULT)
. The way Opaleye typically generates SQL, the Rel8 equivalent to that code would come out looking more likeINSERT INTO table SELECT * FROM (VALUES (DEFAULT)) q
. Because theVALUES
is wrapped in aSELECT
, theDEFAULT
becomes invalud PostgreSQL syntax.To get around this, we special case
VALUES
when generating SQL for INSERT statements. However, something in the Opaleye representation changed and this special case was no longer firing. This commit fixes that.