Hi all,
I am in the process of adding Migration support to the Ingres
ActiveRecord adapter and have run in to a problem. During the call to
create_table the Ingres adapter some how causes ruby to blow the stack
and coredump/segv. I have tracked down the problem down to
“add_column_options!” in
“lib/active_record/connection_adapters/abstract/schema_statements.rb”.
Specifically the following line never gets executed:
sql << " DEFAULT #{quote(options[:default], options[:column])}" if
options_include_default?(options)
As a result the code keeps looping . Comparing the contents of “options”
for MySQL and Ingres I don’t see anything of any significance that would
cause the call not to work. Below is a dump of “options” using
ruby-debug:
MySQL
{:default=>nil,
:column=>#<struct ActiveRecord::ConnectionAdapters::ColumnDefinition
base=#<ActiveRecord::ConnectionAdapters::MysqlAdapter:0xb6fc6f50
@logger=#<ActiveSupport::BufferedLogger:0xb70935f0
@log=#<File:/home/grant/stuff/ruby/rails/auction-demo-mysql/log/development.log>,
@no_block=false,
@auto_flushing=1,
@buffer=[],
@level=0>,
@runtime=0.134179830551147,
@quoted_column_names={“unique_schema_migrations”=>"unique_schema_migrations
",
“schema_migrations”=>"schema_migrations
",
“id”=>"id
",
“auctions”=>"auctions
",
:version=>"version
",
:title=>"title
"},
@connection=#Mysql:0xb6fc8418,
@connection_options=[nil,
“root”,
“”,
“auction_development”,
nil,
nil],
@config={:allow_concurrency=>false,
:adapter=>“mysql”,
:database=>“auction_development”},
@query_cache_enabled=false,
@last_verification=0,
@quoted_table_names={“schema_migrations”=>"schema_migrations
",
“auctions”=>"auctions
"}>,
name=:title,
type=“string”,
limit=255,
precision=nil,
scale=nil,
default=nil,
null=nil>,
:null=>nil}
Ingres
{:default=>nil,
:column=>#<struct ActiveRecord::ConnectionAdapters::ColumnDefinition
base=#<ActiveRecord::ConnectionAdapters::IngresAdapter:0xb7004f80
@primary_key=nil,
@logger=#<ActiveSupport::BufferedLogger:0xb70ceb3c
@log=#<File:/home/grant/stuff/ruby/rails/auction-demo/log/development.log>,
@no_block=false,
@auto_flushing=1,
@buffer=[],
@level=0>,
@runtime=0.0605983734130859,
@connection=#Ingres:0xb7005084,
@query_cache_enabled=false,
@last_verification=0>,
name=:title,
type=“string”,
limit=nil,
precision=nil,
scale=nil,
default=nil,
null=nil>,
:null=>nil}
I was wondering if anyone, had come across something similar when
writing and adapter for ActiveRecord for another database engine. Or if
anyone can point out some things I can try it would be greatly
appreciated
regads
grant
–
Grant Croker - Ingres PHP, Ruby and Python maintainer
I refuse to answer that question on the grounds that I don’t know
the answer.
- (Zaphod B.)