PostgreSQL is an open-source, object-relational database management system (ORDBMS) available for many platforms including Linux, UNIX, MS Windows and Mac OS X. Please mention your PostgreSQL version when asking questions.
0
votes
1answer
18 views
Ruby & SQLite & Heroku & PostgreSQL
I've a simple Sinatra application which I've developed using SQLite. The database is a simple two-column table: an ID and a string entry.
I would like to deploy this app to Heroku. What's the least ...
1
vote
3answers
23 views
Why do I have to provide an items.id column to the group by clause?
I want to return unique items based on condition, sorted by price asc. My query fails because Postgres wants items.id to be present in the group by clause. If it's included the query returns ...
1
vote
2answers
13 views
Proper way to model M:N relationship in SQL where parent may be one of many types
I have a situation where a particular child object may have multiple parents of different types. For example, a foo object may be a child of one ore more of a, b, or c objects. More over, I also have ...
0
votes
0answers
5 views
Cross platform Membership Provider ASP.NET
I'm trying to work a way to allow for ASP.NET membership to be configured once in the web.config, but be able to be configured against both SQL Azure and also Postgres.
I know there are the ...
0
votes
2answers
21 views
How to retrieve all duplicate emails using postgres and ActiveRecord
I found I have many users objects with same email address. I need to delete those duplicates.
User.select(:email).group(:email).having('COUNT(email) > 1')
I tried the following query (which is ...
0
votes
1answer
8 views
PQgetvalue() gets EXC_BAD_ACCESS
I've called my SQL query like so (ommited error checking for post)
PGresult *result = PQexec(self.connection, "SELECT * FROM \"getNewPaths\"()");
const int numRows = PQntuples(result);
int row = 0;
...
0
votes
1answer
14 views
How to copy from CSV file to PostgreSQL table with headers in CSV file?
I want to copy a CSV file to a Postgres table. There are about 100 columns in this table, so I do not want to rewrite them if I don't have to.
I am using the \copy table from 'table.csv' delimiter ...
1
vote
0answers
18 views
Heroku Postgres DB slower after upgrade
2 days ago, I upgraded our Heroku Postgres server from Kappa to Ronin. Our DB was up to several GB and I figured the extra ram would help with the cache. I used the standard fast swapping technique ...
2
votes
1answer
17 views
PL/pgSQL - %TYPE and ARRAY
Is it possible to use the %TYPE and array together?
CREATE FUNCTION role_update(
IN id "role".role_id % TYPE,
IN name "role".role_name % TYPE,
IN user_id_list "user".user_id % TYPE[],
IN ...
-4
votes
0answers
44 views
Convert text to links from words in database [on hold]
I have a table drugs. There are 200 000 records containing names of the drugs and it's growing very very slow.
After creating forum post I want to convert words which are in table drugs to the links ...
0
votes
0answers
18 views
data load scripts in Ruby - Make ETL in ruby scripts more dynamic
I have written a bunch of data loading commandline ruby scripts. Most of the scripts extract data from one database table and load the data to another database. For the most part, there is a ...
0
votes
1answer
12 views
Order by size postgres bytea
I have images stored in a postgresql 9.1 database table in bytea fields.
I want to do a query to order them by size and show their size.
I need this because there are some big images that are causing ...
0
votes
0answers
28 views
Many To Many Database Access
I have designed a user specific database. Where I have multiple tables. One has specific IDs say a1 a2 and a3 and another user has different IDs like b1 b2 b3, stored on the same table. Each Id is ...
0
votes
1answer
29 views
How to aggregate all array values of multiple records in Postgres array?
I have a table full of records and an array column, and now I want to get a list of all (unique) values in that column. What's the best way of getting that?
I tried playing around with unnest, ...
0
votes
1answer
26 views
How to use pg_stat_activity?
I'd like to see which queries are being executed on a live Django application, and how much memory they are taking up. I have read that pg_stat_activity can be useful to monitor a Postgres database.
...