Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

quote_string don't work with some postgres drivers

#94

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'

Reported by Lars Kanis · May 2nd, 2008 @ 09:24 AM

State: resolved
Milestone: none
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: none

Activity

  1. Stephen Celis
    Stephen Celis
    • Title changed from [FIX] quote_string don't work with some postgres drivers to quote_string don't work with some postgres drivers

    May 10th, 2008 @ 02:11 PM

  2. Pratik
    Pratik
    • State changed from new to incomplete

    Can you please provide with more informations to reproduce this ?

    Thanks.

    May 20th, 2008 @ 06:57 PM

  3. Lars Kanis
    Lars Kanis

    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.

    May 21st, 2008 @ 02:08 PM

  4. Pratik
    Pratik
    • State changed from incomplete to open

    May 21st, 2008 @ 08:15 PM

  5. josh
    josh
    • Assigned user set to Jeremy Kemper
    • Tag set to activerecord, patch

    July 17th, 2008 @ 01:54 AM

  6. Repository
    Repository
    • State changed from open to resolved

    (from [79c3f73a7ff9452d1692c6150f8a7503d8afd459]) PostgreSQL: fix quote_string for certain old pg drivers. [#94 quote_string don't work with some postgres drivers state:resolved] http://github.com/rails/rails/co...

    August 28th, 2008 @ 06:52 AM

  7. Repository
    Repository

    (from [b23b19109050af04e2e1d0f57aee306463f4cbb9]) PostgreSQL: fix quote_string for certain old pg drivers. [#94 quote_string don't work with some postgres drivers state:resolved] http://github.com/rails/rails/co...

    August 28th, 2008 @ 06:52 AM

  8. Repository
    Repository

    (from [c2068d14d29ec767c681798b3814f0a8e22fb0ff]) PostgreSQL: fix quote_string for certain old pg drivers. [#94 quote_string don't work with some postgres drivers state:resolved] http://github.com/rails/rails/co...

    August 28th, 2008 @ 06:52 AM