pennylane-hq / activerecord-adapter-redshift

Other
6 stars 27 forks source link

Redshift 7.1 fixes #28

Closed jerryclinesmith closed 6 months ago

jerryclinesmith commented 6 months ago

Fixes issue posted will pull request #27

quentindemetz commented 6 months ago

Thanks Jerry!

r-plus commented 6 months ago

@jerryclinesmith thinks for your fix.

This PR fixed our CI. Additionally, create, create!, save, save! methods are supported by prev PR :)

r-plus commented 6 months ago

hi.

Today we update this gem to this PR merged commit point 38d64be0b24cc41280e010cc8c13cf76191c5991 in production, thus encountered this error when query to redshift.

undefined method `escape' for nil @raw_connection.escape(s)

https://github.com/pennylane-hq/activerecord-adapter-redshift/blob/38d64be0b24cc41280e010cc8c13cf76191c5991/lib/active_record/connection_adapters/redshift_7_1/quoting.rb#L21

But we could not easily reproduce the error on rails console. so just for your information.

jerryclinesmith commented 6 months ago

I was able to replicate the problem by closing the connection before attempting to quote a value:

connection.disconnect!
connection.quote('foo')

I'm guessing the @raw_connection is null unless there is an active connection. It looks like there is a new method valid_raw_connection that should be used to access the raw_connection instead of just referencing the variable.

I'll dig into more when I get a chance and make a pull request.