RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Don't bet on SELECT's order: shuffle your rows and see what folds

SELECT * FROM posts carries no promise about the order of the returned posts. Yet, every relational database hands them back in some order, and code and tests start depending on that order. You can’t grep for a bug like this, but you can smoke it out by deliberately shuffling the rows of every unordered query and seeing what fails. (Rails has since merged a switch of its own from Evil Martians, config.active_record.shuffle_unordered_selects, due in 8.2.) We also share pg_disorder, the open-source PostgreSQL extension we built to do the same thing at the database level.

Don’t bet on SELECT’s order: shuffle your rows and see what folds

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in