circuithub / rel8

Hey! Hey! Can u rel8?
https://rel8.readthedocs.io
Other
150 stars 38 forks source link

Fix insertion of default values #206

Closed shane-circuithub closed 1 year ago

shane-circuithub commented 1 year ago

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.

istathar commented 1 year ago

Any chance of cutting a 1.4.0.1 release with this fix in it?

ocharles commented 1 year ago

@istathar Yessir. Working on it in #226