You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RDS Proxy pins connections if you set variables like sql_auto_is_null
There is a setting to EXCLUDE_VARIABLE_SETS but it is global in nature (all variables).
RDS Proxy allows scaling to many db connections from the rails perspective, without creating tonnes of actual db connections. AWS RDS MySQL maxes out at 16000 connections.
via https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Limits.html
Ask
Consider removing variables['sql_auto_is_null'] = 0 in
<h2 class="summary" style="font-family: arial, verdana, "Bitstream Vera Sans", helvetica, sans-serif; font-weight: bold; letter-spacing: -0.018em; font-size: 16px; margin: 0px 0px 0.8em; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">PATCH] find :conditions => 'id is null' returns a record with a non-null id</h2>
Reported by: | timc | Assigned to: | bitsweat
(https://web.archive.org/web/20100315185851/http://dev.rubyonrails.org/ticket/6778#comment:description)PATCH] find :conditions => 'id is null' returns a record with a non-null id
Reported by: timc Assigned to: bitsweat
Priority: normal Milestone: 1.2
Component: ActiveRecord Version: 1.1.6
Severity: normal Keywords: find mysql null
Cc:
Description
Aa is an empty class, subclassing ActiveRecord::Base. It has one column called 'nothing'
a = Aa.new
=> #<Aa:0xb723dacc @new_record=true, @attributes={"nothing"=>nil}>
a.save
=> true
Aa.find(:first, :conditions => 'id is null')
=> #<Aa:0xb7237050 @attributes={"id"=>"3", "nothing"=>nil}>
Aa.find(:first, :conditions => 'id is null')
=> nil
note the two find calls are identical, but the first call returns an unexpected result.
the log says:
SQL (0.000243) BEGIN SQL (0.000226) INSERT INTO aas (nothing) VALUES(NULL) SQL (0.003979) COMMIT Aa Load (0.001234) SELECT * FROM aas WHERE (id is null) LIMIT 1 Aa Load (0.000842) SELECT * FROM aas WHERE (id is null) LIMIT 1
version info: rails 1.1.6 mysql Ver 14.12 Distrib 5.0.26, for pc-linux-gnu (i686) using readline 5.1 mysql 2.7 gem Gentoo Linux
The text was updated successfully, but these errors were encountered:
Why I'm raising this?
RDS Proxy pins connections if you set variables like
sql_auto_is_null
There is a setting to EXCLUDE_VARIABLE_SETS but it is global in nature (all variables).
RDS Proxy allows scaling to many db connections from the rails perspective, without creating tonnes of actual db connections. AWS RDS MySQL maxes out at 16000 connections.
via https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Limits.html
Ask
Consider removing
variables['sql_auto_is_null'] = 0
inrails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
Line 791 in 39a192f
Since at least MySQL 5.7 this has been defaulted to false.
https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_sql_auto_is_null
It was defaulted to true in MySQL 5.0
see: https://downloads.mysql.com/docs/refman-5.0-en.pdf page 560 (search for
sql_auto_is_null
)System configuration
Rails version:
Rails 4.2.11.3
Ruby version:
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin19]
But this applies to everything using at least MySQL 5.7+
since https://web.archive.org/web/20100315185851/http://dev.rubyonrails.org/ticket/6778 was fixed
(over 10 years ago)
The text was updated successfully, but these errors were encountered: