good_job icon indicating copy to clipboard operation
good_job copied to clipboard

Use Arel::Nodes::NamedFunction to fix COALESCE timestamp generation

Open bananatron opened this issue 10 months ago • 5 comments

  • Fixes https://github.com/bensheldon/good_job/issues/1305 which may actually be a non-issue.
  • The verbosity may not be worth the advantage given the reproducibility of this issue.

bananatron avatar Mar 29 '24 22:03 bananatron

This is lovely! Any chance you could try putting the entire COALESCE into Arel?

bensheldon avatar Mar 30 '24 00:03 bensheldon

@bensheldon I almost never use Arel so lmk if this is better/worse.

bananatron avatar Mar 30 '24 04:03 bananatron

Sorry, I missed entirely that the Arel was then getting to_sql'ed into a larger block of text 🤦🏻

I'm still unsure of why those spaces got inserted into the SQL previously. I'll accept this and maybe someday it will be fully Arel-ized.

bensheldon avatar Mar 30 '24 16:03 bensheldon

@bensheldon I am also unsure :[ but my theory is some weird level rails dependency issue 🤷

bananatron avatar Apr 05 '24 16:04 bananatron

This is coming back with a bundler update, I wonder if the ruby version is somehow involved 🤔

ActiveRecord::StatementInvalid in GoodJob::Jobs#index This prevents me from viewing my jobs page.

Showing /Users/_/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/good_job-3.28.2/app/views/good_job/jobs/index.html.erb  where line #2 raised:

PG::SyntaxError: ERROR:  syntax error at or near ":"
LINE 1: ... ( good_jobs.scheduled_at ,good_jobs.created_at ) : : TIMEST...

Rails 7.1.3.2 Ruby 3.3.1 GoodJob 3.28.2 PG 15

This PR still seems to fix the issue fwiw.

bananatron avatar May 11 '24 15:05 bananatron