These are the features needed to support ActiveRecord using its postgresql database adapter:
unnest built-incol_description built-informat_type built-incurrent_schema{,s}() builtins should return public, not database namearray_in built-inpg_catalog.pg_collationtry_advisory_lock() (Rails 5)current_database() (Rails 5)regfoo typesSAVEPOINTcc @jordanlewis @nvanbenschoten
After #13429 and a workaround for #13468, we manage to successfully make it past all of ActiveRecord's type management and schema creation routines - rake db:migrate on a fairly complex example works without a hitch. Next step is working through and validating some actual CRUD operations via the ORM.
So it turns out common table expressions aren't used before Rails/ActiveRecord 5.0, which was released in June 2016. We could probably claim Rails/ActiveRecord 4.2.6 support without too much more work - notably we wouldn't need #7029 or #13156.
In addition, in order to support Rails 5.0+ without supporting correlated subqueries, we'll need to wait until https://github.com/rails/rails/pull/27743 is released in Rails 5.0.2.
Once https://github.com/rails/rails/pull/27949 makes it into a release, we won't need common table expressions at all.
Rails uses savepoints during transactions. Looks like we'll need to support them. Added #10735 to the list.
We changed strategies and now provide an adapter for CockroachDB support in ActiveRecord. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter and the docs.
Most helpful comment
Once https://github.com/rails/rails/pull/27949 makes it into a release, we won't need common table expressions at all.