2.2.19 breaks on tables with non-ASCII chars in column names

8 views
Skip to first unread message

Ramon Cahenzli

unread,
Aug 6, 2009, 6:27:27 AM8/6/09
to Rails SQLServer Adapter
Hi everyone,

The SQL server adapter is great, but it appears we can't upgrade to
2.2.19 because of one issue: It breaks apart when it encounters a
column title with non-ASCII characters.

We're working on an external partner's database, otherwise I'd say
that no sane person would use non-ASCII characters for column names.
The names are also in German. It's not a happy task, having to write
into this database.

But activerecord-sqlserver-adapter at least makes it possible to write
into it, which lessens the frustration :)

Here's the issue:

RegexpError (premature end of regular expression: /([\w-]*)\s+as\s
+AnlassLektionPeriodizit�t/):
/usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.19/
lib/active_record/connection_adapters/sqlserver_adapter.rb:1004:in
`views_real_column_name'
/usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.19/
lib/active_record/connection_adapters/sqlserver_adapter.rb:1076:in
`column_definitions'
/usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.19/
lib/active_record/connection_adapters/sqlserver_adapter.rb:1062:in
`collect'
/usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.19/
lib/active_record/connection_adapters/sqlserver_adapter.rb:1062:in
`column_definitions'
/usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.19/
lib/active_record/connection_adapters/sqlserver_adapter.rb:618:in
`columns'
/usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.19/
lib/active_record/connection_adapters/sqlserver_adapter.rb:1109:in
`special_columns'
/usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.19/
lib/active_record/connection_adapters/sqlserver_adapter.rb:1113:in
`repair_special_columns'
/usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.19/
lib/active_record/connection_adapters/sqlserver_adapter.rb:815:in
`select'
app/models/evento/sync.rb:10:in `write_course'
app/models/course.rb:90:in `sync_write'
app/controllers/courses_controller.rb:80:in `update'

Is there any way to debug this further or is there anything else that
would help you solve this or narrow down where the problem is? We are
using:

UNIXODBC 2.2.11
FreeTDS 0.82
Debian GNU/Linux 5
Rails and AR 2.3.2

Kind regards,

Ramon

Clifford Heath

unread,
Aug 6, 2009, 6:33:52 AM8/6/09
to rails-sqlse...@googlegroups.com
Temporary solution; define a view with ASCII column names.

Clifford Heath.

Ramon Cahenzli

unread,
Aug 6, 2009, 8:46:36 AM8/6/09
to Rails SQLServer Adapter
Hi Clifford,

On Aug 6, 12:33 pm, Clifford Heath <clifford.he...@gmail.com> wrote:
> Temporary solution; define a view with ASCII column names.

Thanks for the suggestion! Unfortunately, we have no control over the
database itself, we are only allowed to connect via ODBC and do an
update on one single table, not create any views :(

We have hit a catastrophic bug in the old version (doesn't include
some updated fields in the UPDATE statement in production mode, works
perfectly in development) and must now find a workaround for that,
since an upgrade doesn't work.

Perhaps we can also exclude the non-ASCII column names, we're looking
into that as well. We'll keep you posted (if we manage the upgrade,
since the workaround for the old bug surely isn't relevant anymore).

Kind regards,

Ramon

Ken Collins

unread,
Aug 6, 2009, 9:24:11 AM8/6/09
to rails-sqlse...@googlegroups.com

I'll take a look at this sometime this week to. I'm in the middle of
setting up a new work station with DB's and my setup is a mess. So end
of this week next week sometime. Can you create a github issue and/or
a patch too?

- Thanks,
Ken

Ramon Cahenzli

unread,
Aug 6, 2009, 10:29:57 AM8/6/09
to Rails SQLServer Adapter


On Aug 6, 3:24 pm, Ken Collins <k...@metaskills.net> wrote:
> I'll take a look at this sometime this week to. I'm in the middle of  
> setting up a new work station with DB's and my setup is a mess. So end  
> of this week next week sometime. Can you create a github issue and/or  
> a patch too?

Thanks, created an issue!

We're supposed to launch this system in production mode this week, so
I'm not sure if there's time for real productive code. We may find a
hack around it, but it probably won't be worthy of a patch.

At any rate, if we find something, I'll keep you updated.

Ramon
Reply all
Reply to author
Forward
0 new messages