This project is archived and is in readonly mode.
Arel 0.3.2 broke non-standard column types
-
José Valim
- Assigned user set to Emilio Tagua
- Milestone cleared.
-
Ernie Miller
- Tag changed from arel to arel, patch, postgresql
The types that Arel handles are the only ones that should ever show up based on a call to Column#type or a subclass because of the simplified_types call in ActiveRecord::ConnectionAdapters::Column.initialize.
Based on the simplified_types method in active_record/connection_adapters/postgresql_adapter.rb it looks like the problem is that no mapping exists for those column types. This seems to be a problem with the PostgreSQL adapter, not Arel. Can you try the attached patch and see if the problem goes away? I don't run PostgreSQL here, so I haven't tested it, but I think it should do the trick.
-
Ernie Miller
- Tag changed from arel, patch, postgresql to arel, patch, postgresql, tests
Sure. Here you go.
-
Ernie Miller
Adding the file. Was showing the old one for me. Probably just caching on my end but want to be sure.
-
Ernie Miller
Adding the file. Was showing the old one for me. Probably just caching on my end but want to be sure.
-
Ernie Miller
Adding the file. Was showing the old one for me. Probably just caching on my end but want to be sure.
-
Repository
- State changed from incomplete to resolved
(from [98bf00d50d81c522f747131da7071d02815652f3]) Add tests for postgresql column type mapping updates [#4270 Arel 0.3.2 broke non-standard column types state:resolved]
Signed-off-by: Emilio Tagua miloops@gmail.com
http://github.com/rails/rails/commit/98bf00d50d81c522f747131da7071d... -
garrett
I'm getting this error now also. Trying to save PostGIS geometry types back to the database. String would be the correct way to handle these columns as they get shuffled in and out normally as Hex.
NotImplementedError: Column type
is not currently handled<br/>from /Users/garrett/.rvm/gems/ruby-1.9.2-head/gems/arel-0.3.3/lib/arel/engines/sql/attributes.rb:18:in `for' from /Users/garrett/.rvm/gems/ruby-1.9.2-head/gems/arel-0.3.3/lib/arel/engines/sql/relations/table.rb:46:in `block in attributes' -
garrett
here's a patch that should work
-
gucki
The problems still occurs when using custom data types, which is quite common when using pgsql.
Either there should be a way to easily add custom datatypes with their mapping or the adapter should fallback to :string for unknown types.
-
jdguyot
Same problem here. I'm currently migrating our app from Rails 2.3.5 to 3.0b4. We use custom pgsql types which is a really common thing.
class CreateModel < ActiveRecord::Migration def self.up # Create a custom column type execute %{ CREATE TYPE custom_column_type AS ENUM ('item1', 'item2'); } create_table :models do |t| t.column :custom_column, :custom_column_type t.timestamps end end def self.down drop_table :models execute %{ DROP TYPE custom_column_type; } end endI see the same stack than above:
NotImplementedError: Column type `` is not currently handled vendor/gems/arel-0.4.0/lib/arel/engines/sql/attributes.rb:18:in `for' vendor/gems/arel-0.4.0/lib/arel/engines/sql/relations/table.rb:47:in `attributes' vendor/gems/arel-0.4.0/lib/arel/engines/sql/relations/table.rb:46:in `collect' vendor/gems/arel-0.4.0/lib/arel/engines/sql/relations/table.rb:46:in `attributes' vendor/gems/arel-0.4.0/lib/arel/algebra/relations/relation.rb:87:in `[]' vendor/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:1776:in `arel_attributes_values' ... -
Mordekai
- Importance changed from to High
I've got the same problem with Postgres's tsvector type, which is now a standard data type. This issue seems to be as marked resolved prematurely: Some way to add new data types without patching postgresql_adapter.rb is needed, perhaps using a hash added to /config/initializers/postgres_init.rb.
-
Steve Madsen
- State changed from resolved to incomplete
Adding to the chorus, I see the same behavior with a column of type "earth", from the earthdistance contrib module. I don't actually care about updating this column from within the Rails app, but I do need access to the other columns in the table. [state:incomplete]
-
Emilio Tagua
- State changed from incomplete to resolved
Hey,
I think this was solved here:
#5477 Arel won't let ActiveRecord query against tables that have columns it doesn't...
Commit here:
http://github.com/rails/arel/commit/33445ba4c7729970ff8840634c92009...
I'm closing the ticket, feel free to reopen it you find it's still not working.
