Questions tagged [postgresql-9.1]

for PostgreSQL questions specific to version 9.1.

PostgreSQL 9.1 is the version of PostgreSQL released in September of 2011, with expected end-of-life in September of 2016.

While the generic tag should probably be used with all PostgreSQL-related questions, this tag should also be used if the question pertains to features added in version 9.1, or if the question is about a problem seen while running version 9.1.

1821 questions
11
votes
2 answers

Is there any harm to having a duplicate index in Postgresql?

I have the following structure. CREATE TABLE join_table ( id integer NOT NULL, col_a integer NOT NULL, col_b integer NOT NULL ) CREATE INDEX index_on_col_a ON join_table USING btree (col_a); CREATE INDEX index_on_col_b ON join_table USING…
Matthew Rudy
  • 16,724
  • 3
  • 46
  • 44
11
votes
2 answers

How to prevent psycopg2 locking a table

I have a table on a PostgreSQL 9.1 server like this: CREATE TABLE foo(id integer PRIMARY KEY); In an interactive Python shell with psycopg2 (≥ 2.4.2), I might start a connection and cursor, and query this table: import psycopg2 conn =…
Mike T
  • 41,085
  • 18
  • 152
  • 203
11
votes
3 answers

java.lang.IllegalArgumentException: No PersistenceProvider specified in EntityManagerFactory configuration

i have created a maven project and added Spring4, Hibernate4 libs through pom.xml I m trying to link my web app with my database created in PostgreSql, but when i publish my project in apache tomcat 7 the following exception occurs :…
11
votes
1 answer

PostgreSQL integer array value join to integer in other table with desc string

I have a table test column with int arrays and values like {1000,4000,6000} or {1000} or {1000,4000} called ekw. These values match to a description string in another table tab: test id | name | ekw ----------------- 1 | One | {1000} 2 | …
matzeihnsein
  • 678
  • 7
  • 16
11
votes
3 answers

Postgresql : How do I select top n percent(%) entries from each group/category

We are new to postgres, we have following query by which we can select top N records from each category. create table temp ( gp char, val int ); insert into temp values ('A',10); insert into temp values ('A',8); insert into temp…
dpilwal
  • 361
  • 1
  • 5
  • 14
11
votes
1 answer

Saving timestamps in Postgres based on Java dates

I have a Postgres database with a table that contains a timestamp (timeOfProcessing TIMESTAMP). I have a Java datetime value (java.util.Date dateTime) and want to store its value in that timestamp field (without time zone). When I do it using…
Glory to Russia
  • 17,289
  • 56
  • 182
  • 325
11
votes
1 answer

How to install tablefunc in postgres on Mac OS X?

I used StackBuilder to install Postgres 9.2 on my Mac OS X machine. Now I need to use tablefunc and it seems that the function is not available. How do I install the contrib package on the Mac?
Jack Gibson
  • 1,831
  • 5
  • 21
  • 34
11
votes
1 answer

PostgreSQL - CTE upsert returning modified rows

I've written an 'upsert' query using CTEs that looks something like this: WITH new_data (id, value) AS ( VALUES (1, 2), (3, 4), ... ), updated AS ( UPDATE table t set value = t.value + new_data.value FROM new_data WHERE…
connec
  • 7,231
  • 3
  • 23
  • 26
11
votes
1 answer

PostgreSQL - how to restore very large database

I got a little problem when I try to restore a large database (almost 32Go in custom format) on my devel database node (this node has less RAM, CPU... than my production server). My database dumps are generated with a command similar to: pg_dump -F…
Labynocle
  • 4,062
  • 7
  • 22
  • 24
11
votes
3 answers

Postgres concat all

I need connect all columns (unknown columns) from every rows to one string I want do sth like this: select concat(*) from table; The problem is that the function concat doesn't take parameter "*" Anyone can help me? Example: Table GID |…
k2n
  • 113
  • 1
  • 5
11
votes
6 answers

Mountain Lion Postgres could not connect

After my update to mountain lion my postgres doest work. It is still running but my applications cant connect to it anymore. $ ps aux | grep postgres postgres 204 0.0 0.0 2446960 836 ?? Ss 7:31AM 0:00.59 postgres: stats…
Anezio Campos
  • 1,555
  • 1
  • 10
  • 18
11
votes
2 answers

Is it possible, and what is the syntax for a nested hash in Postgresql's HStore type?

I'm not even sure that Postgres' HStore data type can contain nested hashes, and if they can, how to insert them? Here's what I've tried so far: -- Database: test1 -- DROP DATABASE test1; /* CREATE DATABASE test1 WITH OWNER = iainuser …
ian
  • 12,003
  • 9
  • 51
  • 107
10
votes
3 answers

Create array in SELECT

I'm using PostgreSQL 9.1 and I have this data structure: A B ------- 1 a 1 a 1 b 1 c 1 c 1 c 1 d 2 e 2 e I need a query that produces this result: 1 4 {{c,3},{a,2},{b,1},{d,1}} 2 1 {{e,2}} A=1,…
10
votes
3 answers

PostgreSQL: How do I export a function definition to SQL

I have a function (stored procedure) defined in a database that I would like to edit. I think one way of doing this is to dump the function definition to a SQL file, edit the SQL file, then replace the definition in the database with the edited…
Jin Kim
  • 16,562
  • 18
  • 60
  • 86
10
votes
2 answers

PostgreSQL: How to create two instances in same window machine?

I need to have additional instance for our production server. Is it possible? Where to begin? Using Postgresql 9.1 on Windows Server
fLen
  • 468
  • 4
  • 13
  • 25