PostgreSQL is an enterprise class, open-source, object-relational database management system (ORDBMS) available for all major platforms including Linux, UNIX, Windows and OS X. Please mention your exact PostgreSQL version when asking questions.

learn more… | top users | synonyms (1)

0
votes
1answer
35 views

PostgreSQL: How does the implicit index work when using “COPY” for loading bulk rows into a newly created table?

What I know for fast loading bulk rows into a new table is: Create the table(without creating the index) Use "COPY" to load data from a file into the table Create the index What if I added a ...
0
votes
1answer
63 views

I need to copy data from remote Postgres server that has limited disk space and limited connectivity to a server

I have a remote Postgres server recording some data every second. the server has very less space like 6-7 GB, currently I write data to a remote VM server but due to poor connectivity the applications ...
0
votes
1answer
113 views

How to start my 9.2 data directory using an 8.4 server?

I have an old version of postgres (8.4.13) that doesn't run for various reasons. I plan to move the database files in there to a new install of postgres 9.3. How would I go about doing this? For one I ...
0
votes
1answer
377 views

Using the correct postgres server

I'm not sure what happened but I logged in on friday and did psql -d name to access a db that was perfectly running just fine. Then I log in this monday morning and try to access the same database ...
0
votes
1answer
312 views

Better way to restore to existing pg database

We want to restore to an existing 9.3 pg database. What we ended up doing was: 1) delete the database and recreate again, 2) use pg_restore to restore. 3) reboot the ubuntu server to allow rails ...
0
votes
1answer
308 views

Restore postgres in command line on ubuntu failed

This question may be asked many times. We are trying to move a postgres db from windows (psql 9.3) to ubuntu runing postgres 9.3. Here is what we did: In windows, create backup for db cis with ...
0
votes
1answer
545 views

pgAdmin on a fresh OS X Server installation

I know for sure postgresql is running (checked with ps ax), but when I install pgAdmin and try to make a server connection to localhost I get this error: Server doesn't listen The server doesn't ...
0
votes
1answer
106 views

UPDATE Query replacing string primary key taking days to resolve

I'm working with a DB (not designed by me) that had the primary key set to a 47 character length string, which is causing problems due to the fact that the table has over 20 million rows, and this ...
0
votes
1answer
88 views

PostgreSQL replication with fsync disabled?

I need to run PostgreSQL in-memory (for performance reasons), so I intend to disable fsync, which means that no writes will be sent to the WAL. However, as part of my scheme to meet another ...
0
votes
1answer
206 views

Automatically rollback two-phase transactions on session disconnect

I'm using two-phase commit in Postgres to reliably work with an external system (Amazon EC2). I.e. I first do a PREPARE call, then call the external system. If the external system call fails for some ...
0
votes
1answer
297 views

How can I pg_dump my database while excluding extensions?

I am trying to migrate my PostgreSQL 9.3 database to heroku. My database uses the UUID-ossp contrib extension I am not able to load my db onto Heroku because ERROR: permission denied for language ...
0
votes
1answer
395 views

Assign result of regexp_split_to_array() to Pl/pgSQL array variable

How do I create an array and then put a result of a function into it? I'm doing it like this: array text[]; select regexp_split_to_array('whatever this is it splits into array with spaces', E'\\s+') ...
0
votes
2answers
96 views

Check if data from database is up to date

I'm storing some data from database, and want to check if that data is up-to-date from the database version. What is the best way to do this? My ideas: Getting checksum from the table and comparing ...
0
votes
1answer
171 views

Change posgresql 9.3 slave roll password

I need to change the password on my slave posgresql server, because the person who set it up left the password the same as the password for the super user account on our other server. When I run ...
0
votes
1answer
864 views

Unable to Start PostgreSQL. kernel's SHMMAX parameter exceeded you limit

When I am trying to start my PostgreSQL I get the following error in the Postgresql.log file: FATAL: could not create shared memory segment: Invalid argument DETAIL: Failed system call was ...
0
votes
1answer
81 views

Postgresql condition on subquery results

This is a new question based on the solution to my previous question I have the following tables: users int (pk) user_id date last_visit int (fk) local_site sites int (pk) site_id site_stats ...
0
votes
1answer
397 views

While importing 150 GB file on Amazon RDS, why connection is failing?

I am having Postgres database dump file of 150 GB on Amazon EC2 instance. While dumping the data on RDS from EC2 server I am getting error. The output of the command is as given below. It's giving ...
0
votes
1answer
662 views

postgresql bigserial or sequence using jpa

I'm a java developer working with jpa, before to define the indexes in my entities i would like to known which one is faster o better to use?.
0
votes
1answer
70 views

How to index WHERE (start_date >= '2013-12-15')

I have a table named items, and inside the table there is a some_date column, with date as the datatype. I was wondering how can I index the some_date column with PostgreSQL SELECT "items".* FROM ...
0
votes
1answer
88 views

How to ensure a trigger is fired after variable number of inserts?

I have a 1:N relationship between two tables - let's call them "foo" (the parent table) and "bar". I have some triggers on both "foo" and "bar" tables. I insert data in a single transaction, first to ...
0
votes
1answer
43 views

Postgresql: How to add a role that inherits from another?

Pretty cut and dry, I am just a total noob. Is there a way to make a given role inherit from another?
0
votes
1answer
186 views

Compare Number of Rows of Tables

I have two or more tables different by structure and I want to compare their numbers of rows, which I get with the count-star query: select count(*) from table_a For two tables I would like to see ...
0
votes
1answer
245 views

PostgreSQL - Return unique combinations of columns based on where clause

This is quite a long question, please bear with me. So I'd like to first explain I have a database of firewall logs created using the following command: CREATE TABLE firewall_logs_mapped ( ...
0
votes
1answer
484 views

Postgres pgpool increase num_init_children

I am trying to tune postgre to allow many concurrent queries from clients as i am checking how many parallel connections with there queries it can handle. I read A good PgPool II configurataion , ...
0
votes
1answer
2k views

Trying to restore a corrupt Postgresql database, with corrupt data folder. Able to start postgres but the tables are empty?

Postgres 9.3 on Ubuntu 12.04 We had some disk corruption on our server, and after doing a fsck the database would not start. To get us back into production, I copied the postgres data folder, blew ...
0
votes
1answer
171 views

Postgres EXPLAIN ANALYZE behavior

I want to benchmark performance of a particular complicated query JOIN for various values of primary key ID. Most previous approaches say to use EXPLAIN ANALYZE for the query in question and get the ...
0
votes
1answer
122 views

Choosing between single table and multiple table database scheme [closed]

I'm building an application which saves addresses in a PostgreSLQ 9.3/PostGIS 2.1.1 database. Currently I am trying to find an efficient database schema, so far I've come up with two that would ...
0
votes
1answer
307 views

Postgres database migration “zero” downtime

I have a setup with a JBoss EAP server, postgres 9.1 database. I will soon update so I have two JBoss servers in a cluster. This is mostly to avoid downtime when doing application deployments. With ...
0
votes
1answer
99 views

Postgres recovery.conf options

I am setting up Postgres binary replication. In my slave's recovery.conf, I am suggested to have 2 options. I am wondering if the directory specified in restore_command and archive_cleanup_commands ...
0
votes
1answer
215 views

Attributes from an hstore-column as separate columns in a view?

Let's assume we have a table where it has two columns, one an ID and one an hstore column, which stores key/value pairs. You could query that column as such: SELECT name, attributes->'device' as ...
0
votes
2answers
55 views

Help with query statement

EDIT This query seems to work best so far. select host,plugin_id,month,year, row_number() over (partition by plugin_id order by plugin_id) as plugin_split from table where risk in ('High') group ...
0
votes
1answer
51 views

pg_dump inserting C source code in dump file

Am backing up daily my DB with pg_dump. The strange issue is that when I try to restore it with psql, errors are thrown. After opening the dump file with vim and analyzing the line that is causing the ...
0
votes
1answer
185 views

Issues with 'plus symbol' output in PSQL on update query

Simple but frustrating issue... I'm trying to do an update command to correct a misspelling with this field: grouper=> select * from master_list WHERE group ~ 'JustAdopted'; group | ...
0
votes
2answers
452 views

How do I use an Ispell dictionary with Postgres text search?

Postgres can use Ispell-compatible dictionaries in text search, but does not provide the required files.
0
votes
1answer
69 views

What configuration to use for PGbouncer over a WAN link

We have two datacenters, one in America and one in Europe. For various reasons, the Europe datacenter has the database server, while the workers and web apps are in America. PGbouncer is in the ...
0
votes
1answer
83 views

Postgresql Logging Questions

I'm seeking some help understanding my PostgreSQL 9.3 log file. (Note: maybe this should be multiple questions, they are all involve the same general topic - which is understanding my log file). In ...
0
votes
1answer
895 views

PostgreSQL user permissions

I have a PostgreSQL 9.3 database with the PostGIS extension backing a web application and GeoServer. I have created three users. A read only user for accessing the data in the reference data schema. ...
0
votes
1answer
239 views

Automatically generate ALTER TABLE to syncronize schema on PostgreSQL

i Have 2 different database schema in PostgreSQL sql file from pg_dump, is there automated way to generate alter table commands so it would be in sync, without inspecting one by one? this is the ...
0
votes
2answers
67 views

Clobbered default database in postgreSQL

I created a script to drop a particular database and then reload just the structure. I created it using phppgsql. I'm still new to pgsql, so I simply ran the script using \i myCreateScript.sql with ...
0
votes
1answer
59 views

Postgres cannot rename table because of AccessExcusiveLock

I'm trying to rename table. But it had error: LOG: sending cancel to blocking autovacuum PID 11911 Detail: Process 10377 waits for AccessExclusiveLock on database 21819191 relation 24338310 ...
0
votes
1answer
28 views

How to specify the primary key number space for a postgres table?

I have a postgres table that contains data where the id has been set by the code that injected the data. So lets say the id is 0..49. How can I instruct postgres to start with 50 on the id column ...
0
votes
1answer
522 views

Copy PostgreSQL database from a remote server

When I was using MySQL, I could run a command that SSHs into my server and copy the database to my local machine. ssh -t remoteserver 'mysqldump --compress -u dbuser --password="password" db_name' | ...
0
votes
1answer
3k views

PostgreSQL Error : server closed the connection unexpectedly

I cannot connect to PostgreSQL server from PgAdmin III , so i get this error: Error connecting to the server: server closed the connection unexpectedly This probably means the server ...
0
votes
1answer
175 views

can't connect to postgresql with md5 [closed]

I can connect to db with trust, but it is not letting me to connect with md5. It says : "password authentication failed for user "postgres"" Here what I have in pg_hba.config host all all ...
0
votes
1answer
76 views

Query a name in large database, optimizations? [closed]

if you would like to query a name in a very large database, are there some ways to optimize this query? If 1 million names are in the database, and the name has to stay as it was registered (and not ...
0
votes
1answer
71 views

Use regex in postgres

I want to use regexp_replace() to replace the string name1-01.name2-02.1 to name1.01-name2.02.1 How to use the regex here?
0
votes
1answer
102 views

Merge two tables on partly matching column

I have below 2 tables. old_name old_value Tom1 100 Kate1 80 Jim1 70 new_name new_value Tom2 70 Kate2 100 Jim2 80 I want to make a new table look like ...
0
votes
1answer
134 views

store log of update,insert operation of postgresql user

I have to create postgresql user in postgresql 9.0 and give grant on my database xxx and whose all log of insert and update operation should be stored in one external log file so that i can have all ...
0
votes
1answer
2k views

How to convert bytea to text value in postgres?

In my application I insert data in database using C code, since the strings I receive from an untrusted source I have escaped them using PQescapeByteaConn of libpq library. Which is working perfectly ...
0
votes
1answer
1k views

Howto disable Postgres listening on TCP?

Simply to avoid many problems in the first place I do not want my postgres server program to accept/listen to anything from any network (i.e. TCP/IP 4/6) connections. My setup is a Postgres 9.1 on ...