0
votes
1answer
23 views

can i install multiple versions of same db in my localhost?

I am using postgresql . My prod database version is 8.4 . My local database version is 9.1 is there any way i can use multiple version of same db and switch for testing? because some work in 9.x ...
0
votes
1answer
15 views

Populate Temp Table Postgres

I have the following three tables in the postgres db of my django app: publication { id title } tag { id title } publication_tags{ id publication_id tag_id } Where tag ...
0
votes
2answers
11 views

Export and Import tables (not data) using pgAdmin

With pgAdmin, on my created DB, I have seven tables (all of them have at least one primary key, and some of them include foreign keys). Let's suppose in a moment I need to do a mayor correction so I ...
1
vote
2answers
53 views

SQL update missing values from same table

If I have this table ---------- ---------- jones new york jones richard seattle jones richard Ellen Vancouver Ellen ...
0
votes
3answers
39 views

Whats the best way to select fields from multiple tables with a common prefix?

I have sensor data from a client which is in ongoing acquisition. Every week we get a table of new data (about one million rows each) and each table has the same prefix. I'd like to run a query and ...
0
votes
1answer
14 views

Does db_link in postgres auto close connection when used with this format? How to auto close postgres dblink?

I have a query that connects to remote database and brings back results bit it in a function as shown below. CREATE OR REPLACE FUNCTION get_users() $BODY$ BEGIN RETURN QUERY SELECT c.user_id, ...
1
vote
1answer
35 views

Calculate a quotient in one table and store it in another table

I have a small Facebook card game where users can rate each other. Those ratings are stored in a PostgreSQL 8.4.13 table pref_rep as a boolean value nice, which can be null too: # \d pref_rep; ...
0
votes
0answers
32 views

NoSQL(MongoDB) or SQL(Postgrsql) for storing a tree/graph strucutre

i am in the planing phase of a project and i have the following situation: I have an Element with a unique ID, a name and additional information. Each Element can have multiple parents children or ...
2
votes
3answers
103 views

SQL: When it comes to NOT IN and NOT EQUAL TO, which is more efficient and why?

Let's say I have a set of items: Item1 Item2 Item3 Item4 Item5 A query can be constructed in two ways. Firstly: SELECT * FROM TABLE WHERE ITEM NOT IN ('item1', 'item2', 'item3', ...
0
votes
0answers
25 views

PostgreSQL (SQL): INSERT into 2 tables, 1 row table A, multiple rows table B

Im looking for an INSERT script example that allows me to put 1 row in table A and multipe rows in table B! Is this possible? Thanx for the help
0
votes
4answers
62 views

how to normalize / update a “order” column

i have a table "mydata" with some data data : id name position =========================== 4 foo -3 6 bar -2 1 baz -1 3 knork -1 5 lift ...
0
votes
1answer
13 views

postgres multiple JDBC select statements in batch

How do you issue a single JDBC call to Postgres which includes 2 select statements? The two select statements select from different sets of tables and return two different result sets - so cannot be ...
0
votes
2answers
28 views

Change values before insert into table / PostgreSQL

Ive got the following problem. I want to change some values of INSERT statement, e.g. there's a query: INSERT INTO table(a,b) values(x,y); But table has also another column c. I want to check ...
0
votes
2answers
21 views

Getting all results from `includes` while filtering the parent model based on included elements?

I'm working on a small bug in our app which I'll attempt to simplify here. I have this company model (the actual model has many more associations, but this here displays the problem): class Company ...
0
votes
2answers
42 views

Generate series of months in a column at postgresql

In postgresql, how can I generate a series of monthly dates by the format 'YYYY-MM', with the oldest being the creation month of the user up to the current month?

1 2 3 4 5 307
15 30 50 per page