Tagged Questions
2
votes
1answer
125 views
Return value diff between Postgres and MySql
If I do this:
ActiveRecord::Base.connection.execute('select 1 as t').first
on Postgres and MySql I get this:
MySql: [1]
Postgres: {"t"=>"1"}
Can someone explain what that is about?!
1
vote
1answer
35 views
What happens when a query gets very large results
most usages/tutorial/manuals explain how to use the methods in context of a manageable DB.
So if User.where( some condition) would return a result of tens or hundreds it would reasonable to think ...
1
vote
1answer
373 views
PGError: ERROR: relation “companies” does not exist( postgresql , mysql, rails 3)
Recently i added PostgreSQL to my application which was already running on MySQL, now application is running on two databases. I was able to establish associations between the tables present in ...
1
vote
1answer
174 views
Eager loading and group by in PostgreSQL
I know PostgreSQL, unlike MySQL, requires to list all selected fields in the group by clause when using aggregate functions, e.g.
Transaction.select('sum(amount), category_id').group('category_id')
...
0
votes
1answer
14 views
Finding records based on no returned records from a related table
Dealing with two tables in Postgres: Members and Memberships. Memberships have an end_date column that can be NULL if the membership is still running. As soon as it has ended, or the end date is known ...
0
votes
1answer
19 views
Foreign character issue with CSV import to Heroku Postgres DB
I have a rails app where my users can manually set up products via a web form. This works fine and accepts foreign characters well, words like 'Svölk' for example.
I now have a need to bulk import ...
0
votes
1answer
35 views
How to populate join table for a HABTM relationship Rails 3, postgresql
So after searching long and hard for information that can help us, we've found it difficult to find an answer we can work with.
Our problem is that we have two tables joined through a HABTM ...
0
votes
1answer
80 views
PG::Error: ERROR: permission denied for relation schema_migrations
Not sure why I'm running into this error. I've setup postgresql properly, just ran a migration and then rake db:migrate and I'm getting the title error.
Here is my:
database.yml
development:
...
0
votes
1answer
111 views
Get webrick server to run on port 80 with postgres
I'm getting a postgres error when I try to run webrick on port 80 like so:
rvmsudo rails s -p 80
I then get this error:
...
0
votes
1answer
135 views
Download file from PostgreSQL bytea escape
I have some issue to allow users download file, which stored in PostgreSQL bytea escaped field (http://www.postgresql.org/docs/current/interactive/datatype-binary.html).
1.9.3p385 :023 > data = ...
0
votes
1answer
362 views
Updated OS X to 10.7.5, now I can't connect to local PostgreSQL databases
I'm developing several Rails 3.2 applications on Mac OS X Lion. Last night, I updated from 10.7.4 to 10.7.5, and I found this morning that I'm no longer able to connect to my development Postgresql ...
1
vote
0answers
20 views
Rails 3 Saving User Searches DataModel
I am working on a piece of my app where the client is wanting the ability for user searches to be saved (these searches are completed by the user completing a set of dropdowns and then entering in a ...
0
votes
0answers
16 views
How to sum the values of specific key in rails, postgres, store
How do I sum all the values that have a matching key?
For example, I have a flight and duty log where users store times they have flown or worked. I am storing these k/v pairs using hstore. One duty ...
0
votes
0answers
38 views
update query not updating in postgresql
Not updating postgresql database when update_all using
@change_stat = Notification.where("fb_id = ? AND active = ?",@current_user.fb_id,true)
@change_stat.update_all(:active => false)
0
votes
0answers
33 views
Going .pluck crazy. What is a realistic limit on query with array
I've used .pluck(:id) quite often (and map before it) to get a set of record ids. This is usually to get a set of related model records (e.g,, :people has_many :scores, as :assessed)
Lets say I have ...