New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Savepoints being used on old versions of SQLite #5885
Comments
|
Same issue for me. I use rails 3.1.3, rspec2.9, factory_girl 3.2 and sqlite 3.3.6. |
|
I'm having the same issue using sqlite3 version 3.7.7. Has any progress been made on this? Here's my related question on Stack Overflow: http://stackoverflow.com/questions/10406503/rspec-test-fails-with-sqlexception |
|
I have installed sqlite 3.7.2, it works fine now (I forgot to specify I am also on CentOS 5.5 hence initially sqlite 3.3.6). |
|
I was showing version 3.7.7 the day I wrote my previous comment, but went to take another look last night and I was using 3.5.4. Updated to 3.7.10 and the issue was resolved. |
|
Yeah, that's because savepoints are supported as of version 3.6.8 of SQLite. The problem will still exist for anyone who happens to be stuck on an older version. |
|
I'm a little baffled at why I was seeing 3.7.7, but happy just to see all my test passing |
|
I have install sqlite 3.7.12 but the problem still exists any suggestions |
|
I have got sorted let me post it here it might help someone.
|
|
hmm, my problem is that if I install the sqlite from source, Istill have to keep the yum version (because yum depends on it). |
|
did you try updating with yum? |
|
Yes, but no help. Still the same error. |
|
can you send you errors please? I mean stack dump |
|
Sqlite 3.6.8 was released on 2009 Jan 12. Just upgrade your sqlite3 and this isn't an issue. |
|
steve you might wanna look the comment I posted above that exactly what I said |
|
@alirz23 this issue is quite old anyway, I would keep it closed, unless someone is able to reproduce it in clean rails application (or write failing test in rails test suite). |
|
Yep. If we can demonstrate that this is working with a clean rails and a modern distro (centos 5 isn't even the current version of the os...) then we could re-open. @alirz23 your comments are good! We're in agreement. No answer to your question in four months means we can't help. |
|
I'm on OSX 10.5.8, rails 3.2.8 (via rvm), just upgraded to sqlite3 3.7.14 via macports: And... Hmmmm - the problem still persists Tried reinstalling the sqlite3 gem - no luck. |
|
@doctorpod could you provide steps to reproduce it on bare rails app? |
|
On my machine: |
|
@drogus Here's how to reproduce: Bingo! Here's test/unit/bar_test.rb: |
|
@doctorpod prefix it to --prefix=/usr should solve your problem |
|
On my machine: |
|
@steveklabnik Don't you just love it when you can't reproduce a bug ;) So what's different between my env and yours? |
|
Heh. I know, right? :( Here's mine, for comparison: |
|
Looks like the only thing that's older with yours is the OS... |
|
Might try reproducing the problem on my other Mac which is running Snow Leopard. Watch this space... |
|
Same problem here (savepoint error running rake test after building a default scaffold model), I am also on an old macOS version. My environment is: |
|
My gut feel is that the sqlite3 gem is using the original version of sqlite3 installed on my machine at /usr/bin/sqlite3, rather than the later version installed via ports at /opt/local/bin/sqlite3. The temporary workaround for me is to use MySQL (just edit the config/database.yaml file accordingly) - which works but is annoying: A likely fix would be to update to the latest sqlite3 to it's normal system location (which I think @alirz23 alluded to) but I think I'm going to bite the bullet in a week or two, upgrade to Leopard and switch to homebrew - see if that fixes it. |
|
That sounded like a good theory, but removing the old sqlite3 from /usr/bin (so the only sqlite3 binary around is the 3.7.14 I installed with homebrew) didn't fix the problem, I still get the same error: |
|
@javiervegas install it in /usr/bin that should fix it |
|
I tried that, copied the new sqlite3 there but still get the error when running tests |
|
Still happening in 2015:
$ rails new issue_5885
$ bundle list
Gems included by the bundle:
* actionmailer (4.2.4)
* actionpack (4.2.4)
* actionview (4.2.4)
* activejob (4.2.4)
* activemodel (4.2.4)
* activerecord (4.2.4)
* activesupport (4.2.4)
* arel (6.0.3)
* binding_of_caller (0.7.2)
* builder (3.2.2)
* bundler (1.10.6)
* byebug (8.2.0)
* coffee-rails (4.1.0)
* coffee-script (2.4.1)
* coffee-script-source (1.10.0)
* debug_inspector (0.0.2)
* erubis (2.7.0)
* execjs (2.6.0)
* globalid (0.3.6)
* i18n (0.7.0)
* jbuilder (2.3.2)
* jquery-rails (4.0.5)
* json (1.8.3)
* loofah (2.0.3)
* mail (2.6.3)
* mime-types (2.6.2)
* mini_portile (0.6.2)
* minitest (5.8.2)
* multi_json (1.11.2)
* nokogiri (1.6.6.2)
* rack (1.6.4)
* rack-test (0.6.3)
* rails (4.2.4)
* rails-deprecated_sanitizer (1.0.3)
* rails-dom-testing (1.0.7)
* rails-html-sanitizer (1.0.2)
* railties (4.2.4)
* rake (10.4.2)
* rdoc (4.2.0)
* sass (3.4.19)
* sass-rails (5.0.4)
* sdoc (0.4.1)
* spring (1.4.1)
* sprockets (3.4.0)
* sprockets-rails (2.3.3)
* sqlite3 (1.3.11)
* thor (0.19.1)
* thread_safe (0.3.5)
* tilt (2.0.1)
* turbolinks (2.5.3)
* tzinfo (1.2.2)
* uglifier (2.7.2)
* web-console (2.2.1)
$ rails g model bar name
$ rake db:migrateEdit test/models/bar_test.rb require 'test_helper'
class BarTest < ActiveSupport::TestCase
test "the truth" do
assert Bar.create(name: 'Fred')
end
end$ rake test:units
Finished in 1.536349s, 0.6509 runs/s, 0.0000 assertions/s.
1) Error:
BarTest#test_the_truth:
ActiveRecord::StatementInvalid: SQLite3::SQLException: near "SAVEPOINT": syntax error: SAVEPOINT active_record_1
test/models/bar_test.rb:5:in `block in <class:BarTest>'
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips |
|
@duffyjp can you open a new issue and reference this one? |
We're using an old version of SQLite on CentOS 5 in which savepoints are not supported:
And it looks like ActiveRecord has code to check whether savepoints are supported on the current version of SQLite (i.e. the supports_savepoints? method):
https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb#L98-101
However, we are still seeing tons of these failure messages in our tests:
So why are savepoints being used anyway?
For what it's worth (I don't know if this actually means anything), I grepped the rails source for "supports_savepoints," and I couldn't find where this method was being used (except in tests):
The text was updated successfully, but these errors were encountered: