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
I'm getting errors with Postgres 12.x and Rails 6.1 when doing any modifications on the hierarchy like simply trying to set a parent and saving the model or doing a full rebuild.
/home/app/webapp/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:672:in `exec_params': PG::UndefinedColumn: ERROR: column "id" does not exist (ActiveRecord::StatementInvalid)
LINE 1: ...ndant_id", "generations") VALUES ($1, $2, $3) RETURNING "id"
The hierarchies table exists and has the 3 expected columns but no id column as generated by the migration, so the RETURNING "id" must not be there, or maybe RETURNING "*" or similar. Digging through AR source code, this uses primary_key or false, so one might be able to set the primary_key to false in the Hierarchy class for the model. However, when setting primary_key to nil later, I got another error: home/app/webapp/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/reflection.rb:307:in primary_key': Unknown primary key for table ... `
If it may be relevant for the issue: My data structure in multiple classes (saved as STI) however not all of the many classes have closure_tree. The STI root class does not but one Subclass FooWithHierarchy (and with more subclasses of it) have_closure_tree.
I have another quite similar situation in another project, also Rails 6.1 and identical Gem versions but PG 13 which does not seem to have this issue. However, it started earlier and thus may have been populated before any breaking changes. So.... very confusing why one seems to work and one doesn't.
The text was updated successfully, but these errors were encountered:
I'm getting errors with Postgres 12.x and Rails 6.1 when doing any modifications on the hierarchy like simply trying to set a parent and saving the model or doing a full rebuild.
The hierarchies table exists and has the 3 expected columns but no id column as generated by the migration, so the
RETURNING "id"
must not be there, or maybeRETURNING "*"
or similar. Digging through AR source code, this uses primary_key or false, so one might be able to set the primary_key to false in the Hierarchy class for the model. However, when setting primary_key to nil later, I got another error:home/app/webapp/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4.1/lib/active_record/reflection.rb:307:in
primary_key': Unknown primary key for table ... `If it may be relevant for the issue: My data structure in multiple classes (saved as STI) however not all of the many classes have closure_tree. The STI root class does not but one Subclass
FooWithHierarchy
(and with more subclasses of it) have_closure_tree.I have another quite similar situation in another project, also Rails 6.1 and identical Gem versions but PG 13 which does not seem to have this issue. However, it started earlier and thus may have been populated before any breaking changes. So.... very confusing why one seems to work and one doesn't.
The text was updated successfully, but these errors were encountered: