CSNW/sql-bricks

`noWait` generates incorrect SQL

joelmukuthu opened this issue · 4 comments

select('addr_id').from('person').forUpdate().of('addr_id').noWait();

generates:

SELECT addr_id FROM person FOR UPDATE OF addr_id NO WAIT

while it should generate:

SELECT addr_id FROM person FOR UPDATE OF addr_id NOWAIT

As far as I can tell, postgres, oracle and mysql all have it as NOWAIT.

prust commented

@joelmukuthu: Thank you for contributing this fix! I'm sorry I didn't respond sooner, I'm not sure how I didn't see this or didn't notice the notification.

FWIW, for the final 3.0 version I'll move FOR UPDATE and NOWAIT out to the postgres/mysql extension libraries (I'm not sure if anyone has made an oracle extension library yet) in order to keep the core library small and focused exclusively on SQL-92. But for now, the I'll merge the fix directly in; it's appreciated.

@prust no worries, and thank you!

@prust Can we backport this to the 2.x branch? I still have my base branch and can open a new PR targeting 2.x. Asking first since I'm not sure if that's aligns with your plans for FOR UPDATE and NOWAIT?

prust commented

@joelmukuthu: yes, that would be great. Sorry I thought of this & should've mentioned it.