All Questions
Tagged with ruby postgresql
3,532
questions
0
votes
0
answers
37
views
How can I fix Postgres errors in Minitest?
I am using Minitest and Postgres to test my Rails website. When I added a "Like" model, I started getting Postgresql deadlock errors
Minitest::UnexpectedError: ActiveRecord::Deadlocked: PG::...
0
votes
1
answer
34
views
Ruby with Postgresql raising NumericValueOutOfRange
I'm trying to do the following query using ruby and pqsql, but when trying a range with more than 1.000 registers I'm receiving an error.
.
.
.
user.left_outer_joins(:coverage_radius).where(id: i)....
0
votes
2
answers
119
views
Is there any simple way to transform jsonb field into csv? [closed]
I have a model with a jsonb field where responses from a third-party service are stored. The response changes periodically; some fields are added, some disappear. I want to generate a CSV from a ...
1
vote
2
answers
118
views
Processing 500k records crashes the server. How to batch it?
I have a database table holding 500k records. I need to load these records, do an API call, fetch data from this API endpoint, and save new data back to the database.
I tried to do it like this (...
0
votes
2
answers
117
views
Rails - how to "generate" statistics from hundreds of thousands of data in PostgreSQL database?
I have a model Item with the corresponding database table items where is currently about 240,000 records.
I need to generate statistics from the data in the items table on my dashboard. Currently, I ...
-1
votes
1
answer
76
views
Rspec on Docker with database_cleaner causes remote URL error: RemoteDatabaseUrl
I'm working in Docker, trying to run bundle exec rspec ./spec/services/something/something_spec.rb and I am getting this error
DatabaseCleaner::Safeguard::Error::RemoteDatabaseUrl:
ENV['DATABASE_URL'] ...
0
votes
1
answer
34
views
rollback database in local doesn't update postgres in server Rails 7
I'm running Rails 7 on my server, even though when I add a new table, it does migrate and I can see it in the server database. But when I made changes by rolling back in development environment, and ...
1
vote
0
answers
99
views
Getting randomly PG::Error: can't open large object with rails application
I have a rails application using postgresql 16, i am using latest version 1.5.6 of pg gem.
I have the below method:-
def file_length
transaction do
lo = active_connection.lo_open(self.oid, ...
1
vote
0
answers
70
views
how can we use model object method in rails select query
I have two models, first one is User with attributes first_name, last_name and second one is Organization with attribute partner_level which is enum {standard: 'standard',standard_plus: 'standard_plus'...
0
votes
1
answer
71
views
Correct Alphabetical Order - platform-wide solution
Currently in our app we do not override the system’s default method for alphabetizing data, it will sort capital letters over lowercase letters.
How to enable case-insensitive across the application ...
0
votes
1
answer
62
views
Issue of User Duplication in Rails Application
I'm using
'rails', '~> 5.2.4', '>= 5.2.4.1'
ruby '2.7.1'
and gem 'pg', '>= 0.18', '< 2.0'
I'm encountering an issue in my Rails application where some users are being duplicated in the ...
0
votes
1
answer
89
views
Rails Active Record Statement Invalid Undefined column
I'm completely new in using ruby on rails and active record.
I cant seem to figure out why I keep getting this error. I am trying to delete soccer teams through the destroy method and it wont work. ...
0
votes
1
answer
40
views
Rails query working in console but not in the controller
I have an application that has a table Doctors with a name field. The users can put any version of the name in there they want. I'm trying to sort the records based on last name(last word in the ...
2
votes
0
answers
52
views
Is loading structure.sql using rake an atomic transaction?
Is loading structure.sql via rake atomic?
If I load structure.sql using this command and it fails because of an error within the structure.sql file:
$ bundle exec rake db:schema:load RAILS_ENV=test
...
1
vote
1
answer
51
views
PgHero gem error "No connection pool for 'PgHero::Connection::Database337600' found."
I'm using RubyOnRails 6.1 with multiDB setup: primary and follower.
CustomDatabaseResolver is configured to distribute load between databases.
class CustomDatabaseResolver < ActiveRecord::...