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.

postgresql_adapter doesn't disable referential integrity for pg 9.0

#5635

When running tests, referential integrity is not disabled for PG 9.0. The method supports_disbale_referential_integrity? in the active_record/connection_adapters/postgresql_adapter.rb checks for versions greater than 8 AND with a minor version greater than 1. So, it does not correctly handle PG 9.0.

I have a patch that uses the scaler postgresql_version that is widely used in the module. The patch also fixes the module's parsing of version revisions when a release number is missing (9.0 vs 9.0.1).

Reported by noelp · September 15th, 2010 @ 10:26 PM

State: resolved
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. noelp
    noelp
    • Tag changed from active_record, postgres, postgresql to active_record, patch, postgres, postgresql

    September 15th, 2010 @ 10:56 PM

  2. Sokolov Yura
  3. olore
    olore

    +1 This same fix can be applied to 2.x.

    November 19th, 2010 @ 06:41 PM

  4. MatthewRudy
    MatthewRudy

    +1 on this I ended up coding the same thing.

    You got there first
    :)

    November 20th, 2010 @ 04:23 PM

  5. MatthewRudy
    MatthewRudy

    By the way, though.
    Why did you just comment the old code?

    Here is my patch.
    kind of the same,
    but I bit cleaner (I feel)

    November 21st, 2010 @ 12:51 PM

  6. MatthewRudy
    MatthewRudy

    By the way, though.
    Why did you just comment the old code?

    Here is my patch.
    kind of the same,
    but I grab the string a bit more cleanly (I feel)

    if query('SELECT version()')[0][0] =~ /PostgreSQL ([0-9.]+)/
      major, minor, tiny = $1.split(".")
      (major.to_i * 10000) + (minor.to_i * 100) + tiny.to_i
    else
      0
    end
    
    my branch on github. https://github.com/matthewrudy/rude-rails/tree/disable-keys-for-pos...

    November 21st, 2010 @ 12:55 PM

  7. MatthewRudy
    MatthewRudy

    In order to get by for the moment,
    I have added this as an initializer.

    Check out my gist.
    https://gist.github.com/709480

    November 22nd, 2010 @ 03:37 AM

  8. noelp
    noelp

    Matthew's Patch is cleaner. I have no idea why I left the old code commented out.

    November 22nd, 2010 @ 04:10 PM

  9. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to resolved
    • Importance changed from to Low

    December 11th, 2010 @ 06:53 PM

  10. MatthewRudy
  11. bingbing