Tagged Questions
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
4 views
Model Filtering Joins
This is my posting model. Posts have many user_ids through postings. I'd like to return the Posts that have user_id 2 and 3. So posts with ID 7 and 8.
Ideally my code would look something like ...
0
votes
0answers
8 views
how to deploy a postgresql application wiht node.js on cloudfoundry
this is a app.js, I can debug it on my ubuntu system correctly.but when I depoly it to my cloudfoundy , the process of deploy occur a error. I user vmc push app.js, but cloudfoundry tell me not find ...
0
votes
0answers
9 views
Postgres - using DISTINCT ON to get first row, but also getting the COUNT(*) work
I'm using
SELECT DISTINCT ON()
to return a particular row from a group of rows. Works well. But what I also want to return is the "COUNT(*)". So it might look like
SELECT DISTINCT ON(name)
...
0
votes
2answers
21 views
Is the this function executed twice?
In the code below:
select t.id, ST_AsText(t.geom) AS tgeom, s.name, ST_Length(ST_ShortestLine(t.geom,s.geom)) AS short,t.par
from teta t, str_lines s
Where ...
0
votes
1answer
7 views
postgresql transpose rows an columns misery
I have gone through all of the similar topics and can't seem to solve my problem. I have a table like this:
id[PK] key[PK] value
--------------------------------
22 ingfs ...
1
vote
0answers
15 views
Should I ignore schema.rb because extension differs on development/production OS?
My database uses PostgreSQL. I develop on Mac and this line is needed:
# db/schema.rb on Mac environment
enable_extension "plpgsql"
However, the extension is not required on Linux.
In this ...
0
votes
2answers
25 views
How to recreate primary after dropping primary key column?
I would like to recreate a primary key column in pg 8.4. But the query i am trying does not work ( it does not execute actually):
update beta
set id=rown
from
(select row_number() as rown
...
0
votes
2answers
16 views
Storing nested Hashes in PostgreSQL with Rails 4 (and Hstore)
I have a Rails app that aggregates a lot of data from Google API's. I store the JSON responses in MongoDB currently (so my Rails app has both pg and mongo). However, today, I've came across PostgreSQL ...
2
votes
1answer
10 views
Brew info in Lion is missing characters with postgres
I have a fresh install of Lion that I just installed brew on. However, after it seemed to install, there are missing characters in the brew info. Furthermore, when I check for postgres versions, it ...
0
votes
1answer
7 views
Parsing the value and copying it to another column in postgresql
Column_1(varchar) has values with the format like 1024 MB , 2048 MB etc. There also exits Column_2(int). Now i would like to parse the value in column_1 and update the column_2 with values like 1024, ...
0
votes
1answer
4 views
How do you create and edit tables etc in a PostreSQL database on heroku if I'm running Snow Leopard?
If I had Apple's Lion (or higher) OS, I would simply:
-follow heroku tutorial: https://devcenter.heroku.com/articles/heroku-postgresql#local-setup
-install postgres.app on my OS
-run "heroku ...
0
votes
1answer
34 views
Programmatically get all tables of a database owned by a user
I created the following query:
select
is_tables.table_name
from information_schema.tables is_tables
join pg_tables
on is_tables.table_name=pg_tables.tablename
where
...
0
votes
0answers
4 views
shp2pgsql not functioning properly
I am trying to use shp2pgsql to generate an sql file but every time I try, it does nothing except spit out the USAGE and OPTIONS. As far as I can tell I am entering the command correctly. These are ...
0
votes
1answer
16 views
Grouping in Ruby on Rails using PostGres
I have the following line of code which works in sqlite, but in PostGres doesn't:
@income_by_category = SoldCategory.group(:category_name).having("branch_id=?", @branch_id).sum(:total).to_a
It's ...
0
votes
0answers
19 views
PostgreSQL optimization: running select queries on preselected subset
I need to run multiple (lots of!) selects on a table (obviously simplified):
libraries_books
---------------
id
library_id
book_id
where I'll be looking for different book_id's on the same ...