This project is archived and is in readonly mode.
quote_string don't work with some postgres drivers
Reported by Lars Kanis | May 2nd, 2008 @ 09:24 AM
A special code path is used for postgres drivers that don't define PGconn.escape. This code path does not work and throws the following exception.
Attached is a patch with the simple fix.
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:352:in `quote_string': undefined method `quote_string' for # (NoMethodError)
from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/quoting.rb:19:in `quote'
from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:333:in `quote'
from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1880:in `quote_bound_value'
from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1851:in `replace_bind_variables'
from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1851:in `gsub'
from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1851:in `replace_bind_variables'
from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1819:in `sanitize_sql_hash_for_conditions'
from d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1778:in `sanitize_sql'
Comments and changes to this ticket
-
Stephen Celis May 10th, 2008 @ 02:11 PM
- Title changed from [FIX] quote_string don't work with some postgres drivers to quote_string don't work with some postgres drivers
-
Pratik May 20th, 2008 @ 06:57 PM
- State changed from new to incomplete
Can you please provide with more informations to reproduce this ?
Thanks.
-
Lars Kanis May 21st, 2008 @ 02:08 PM
Thanks for answering.
Attached you can find a i386-msvcrt-compiled older version (0.7.1) of the postgres-driver. With this version any database activity will result in the exception above.
This driver doesn't define PGconn.escape. In this case the postgresql_adapter.rb should use the quote_string() from quoting.rb.
But what the quote_string() in postgresql_adapter.rb actually does, is to remove quote_string() entirely from the base class too. So undef_method needs to be changed to remove_method.
Pre ActiveRecord 2.0 versions didn't use PGconn.escape, so the attached binary driver worked out of the box.
Hope the report is more complete now.
-
Pratik May 21st, 2008 @ 08:15 PM
- State changed from incomplete to open
-
josh July 17th, 2008 @ 01:54 AM
- Assigned user set to Jeremy Kemper
- Tag set to activerecord, patch
-
Repository August 28th, 2008 @ 06:52 AM
- State changed from open to resolved
(from [79c3f73a7ff9452d1692c6150f8a7503d8afd459]) PostgreSQL: fix quote_string for certain old pg drivers. [#94 state:resolved] http://github.com/rails/rails/co...
-
Repository August 28th, 2008 @ 06:52 AM
(from [b23b19109050af04e2e1d0f57aee306463f4cbb9]) PostgreSQL: fix quote_string for certain old pg drivers. [#94 state:resolved] http://github.com/rails/rails/co...
-
Repository August 28th, 2008 @ 06:52 AM
(from [c2068d14d29ec767c681798b3814f0a8e22fb0ff]) PostgreSQL: fix quote_string for certain old pg drivers. [#94 state:resolved] http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 94 quote_string don't work with some postgres drivers (from [79c3f73a7ff9452d1692c6150f8a7503d8afd459]) Postgre...
- 94 quote_string don't work with some postgres drivers (from [b23b19109050af04e2e1d0f57aee306463f4cbb9]) Postgre...
- 94 quote_string don't work with some postgres drivers (from [c2068d14d29ec767c681798b3814f0a8e22fb0ff]) Postgre...