Comments (9)
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.
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.
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.
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.
the above was on activerecord 5.2.6
from safe-pg-migrations.
> SafePgMigrations.alternate_connection.raw_connection.type_map_for_results
=> #<PG::TypeMapByOid:0x0000560181136720>
``
from safe-pg-migrations.
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.
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.
Hey @jakswa, I was lucky enough to reproduce this issue; it's now fixed :)
from safe-pg-migrations.
Related Issues (16)
- Support default value on a table where id is a UUID HOT 9
- using change_column_null can make the migration fail
- `SET` and `disable_ddl_transaction!` HOT 1
- add_column, null: false should be executed in one statement
- Wrong number of arguments - Rails 6.1 HOT 2
- Can't rollback an add_index migration HOT 7
- strong-migrations warns about dangerous operation when adding foreign key
- Safe rename table & column HOT 2
- Idea: only disable DDL transaction for transactions that use helpers HOT 3
- Adding a foreign key causes `ArgumentError: unknown keyword: :column` HOT 1
- Option to disable IdempotentStatements? HOT 2
- Error undefined method `table' for "index_name":String on v1.4.0 HOT 4
- question: Is there a way to disable logging for some migrations? HOT 4
- safe rename_column seems to be missing? HOT 13
- Escape hatch for unsafe migrations HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from safe-pg-migrations.