Giter VIP home page Giter VIP logo

Comments (9)

jakswa avatar jakswa commented on June 23, 2024

mid-testing on this patch, maybe it solves things for older gem versions (if that's the issue): jakswa@3077be4

     def format_start_time(start_time, reference_time = Time.now)
+      start_time = Time.parse(start_time) if start_time.is_a?(String)
       duration = (reference_time - start_time).round
       "transaction started #{duration} #{'second'.pluralize(duration)} ago"
     end

from safe-pg-migrations.

rchoquet avatar rchoquet commented on June 23, 2024

Hello @jakswa, thanks for the report!

Which version of PG and of the pg gem are you using?

Your fix looks right, but it might be valuable to identify the root cause.

from safe-pg-migrations.

jakswa avatar jakswa commented on June 23, 2024

Hello @jakswa, thanks for the report!

No problem! I'm excited to try and guard against some of the blunders this gem seems to solve.

Which version of PG and of the pg gem are you using?

I was testing this locally on:

  • PostgreSQL 13.4 (Ubuntu 13.4-0ubuntu0.21.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0, 64-bit
  • pg gem version 1.2.3

Your fix looks right, but it might be valuable to identify the root cause.

Agree. I tried some quick digs trying to find a version to alter and test, but I am in a bit of a time crunch in a big rails repo with lots of gem dependencies.

from safe-pg-migrations.

rchoquet avatar rchoquet commented on June 23, 2024

Ok, you could be missing the proper type_map_for_results on your PG connection, could you check the output of SafePgMigrations.alternate_connection.raw_connection.type_map_for_results?

For me it's PG::TypeMapByOid, I suspect yours could be the default one (PG::TypeMapAllStrings).
If that's the case, it might have to do with the version of activerecord you are using, that might create the connection without the proper defaults.

Could you please indicate the version of activerecord you are using so I can check?

(a proper fix in this case could be to assign the right type map for the alternate connection, so the PG client takes types into account)

from safe-pg-migrations.

jakswa avatar jakswa commented on June 23, 2024

the above was on activerecord 5.2.6

from safe-pg-migrations.

jakswa avatar jakswa commented on June 23, 2024
> SafePgMigrations.alternate_connection.raw_connection.type_map_for_results
=> #<PG::TypeMapByOid:0x0000560181136720>
``

from safe-pg-migrations.

jakswa avatar jakswa commented on June 23, 2024

The last message got me thinking that we might have a monkey-patch or override in play somewhere messing with this, but so far my attempts at disabling random hooks/gems/etc have failed to get the issue to go away. So, that's saying: This could be a me/us issue if no one else can reproduce and maybe we're just settling in to maintain our forked patch.

If I find time to get a rails skeleton going to reproduce, I'll give that a go, so there's hope later maybe. Maybe I can get solid steps for reproduction.

from safe-pg-migrations.

jakswa avatar jakswa commented on June 23, 2024

Haven't gotten around to find time for accurate reproduction steps, I'll close this until there's more movement. Sorry to leave it hanging around!

from safe-pg-migrations.

ThHareau avatar ThHareau commented on June 23, 2024

Hey @jakswa, I was lucky enough to reproduce this issue; it's now fixed :)

from safe-pg-migrations.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.