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
2answers
29 views

How to use Italian locale for Postgres messages

On Oracle I have set: export NLS_LANG=Italian_ITALY.UTF8 .. on Unix shell and now I get status and error message in Italian. How to set in Postgres shell (psql)? I have set: SET lc_messages TO ...
3
votes
1answer
100 views

How to index for timestamp queries

I have a products table where I insert around 150,000 records a day. Most of them are redundant, but I need to keep them because of the new expiration date. I get product feeds from about 5 vendors a ...
2
votes
0answers
68 views

Warm Standby PostgreSQL 9.4 error; FATAL: the database system is starting up [closed]

I want to setup a Master and a warm standby, so far here's what I have setup: Master postgresql.conf listen_addresses = '*' wal_level = archive archive_mode = on archive_command = 'copy "%p" ...
1
vote
1answer
53 views

Reduce the number of queries to the same table

I need to build some reports using two tables: AuthorTitles: id(pk), author_id, title_id AuthorReports: id(pk), author_id, title_id, items_sold, date My report needs to output the fallowing: ...
0
votes
1answer
31 views

Postgres: Disable “similarity” column output on “SELECT SIMILARITY”?

I've tried disabling similarity column output on SELECT SIMILARITY but still cannot. Below query will generate a column similarity: SELECT SIMILARITY(title, 'Nation'), title FROM gallery WHERE title ...
2
votes
2answers
36 views

PostgreSQL: options for large table [closed]

I'm working on a project dealing with genomic data in a Postgres database. There is one table in particular which is causing trouble. It is slowly approaching a billion rows and has three columns: ...
2
votes
1answer
102 views

Multi-row uniqueness constraint, checking a field has one of two values

I'd like to enforce that only one row in a database matches value A in column 1, and either value B or value C in column 2. A small example create table builders ( id text serial ); create table ...
1
vote
1answer
55 views

postgresql won't install dependencies

Please help me figure out why postgresql isn't playing nice with updating. I can't find anything on SO or Google that remedies this problem. This is a production server and a distribution reinstall ...
0
votes
0answers
42 views

What are the compression options for storing large amounts of text in Postgres?

I need to store large amounts of text in Postgres, mainly command logs and the output of long running commands and need to know if there are some settings that could help compress the data ...
0
votes
0answers
38 views

Writing audit trail funtionality in postgres, can I use pl/V8 instead of pl/pgSQL?

I'm using postgres 9.4 on Amazon RDS. This the fast and loose "application developer" definition of an audit trail. The audit trail isn't for security nor is it a legal requirement - I don't even ...
1
vote
0answers
18 views

Compound key that only allows nulls if they are null in the referenced table

I want to create a compound foreign key constraint that only allows a null value in one of the columns if there is a matching row with a null value in the referenced table. Additionally, the ...
0
votes
1answer
66 views

How to change database encoding in an Amazon RDS Postgresql instance?

I need to create a database with SQL_ASCII encoding in Amazon RDS PostgreSql database instance. Since template0 and template1 are both with utf8 encoding, I get the following error $ createdb -h ...
0
votes
1answer
43 views

Autovacuum on windows

I just installed postgres on my windows system. I configure also postgressql.conf but when I look into the windows processes I cannot see autovacuum process running or even with process explorer ...
0
votes
0answers
12 views

Managing View Dependencies

I am using PostgreSQL and I am adding a single column to a view. Unfortunately, I will have to drop and recreate that view as well as the 9 other views that are dependant on the view. What ...
0
votes
2answers
40 views

change column type from string to numeric

so I have a table with 5.2 million records. 3 columns in this table are for salaries. Those column are currently stored as string and I'd like to change the data type to numeric (I understood while ...
1
vote
1answer
14 views

Is it possible to use a column value as the argument to a hypothetical-set aggregate function?

Say I have a table like the one described below. Table "public.foo" Column | Type | Modifiers ...
0
votes
0answers
33 views

How to work with multiple Postgres databases in psycopg2

I have two different Postgres databases on two different servers (one is actually local). Similar to this question, I would like to work with both databases at the same time. However, I can't figure ...
1
vote
4answers
66 views

Getting an aggregate (here: min) for a group of values [closed]

Example table: ID | value A | value B ---------------------- 1 | abc | 3 1 | def | 5 1 | ghi | 1 2 | cba | 9 2 | fed | 4 I want the ...
0
votes
1answer
30 views

Unable to grant permission on table

I've been given credentials to a postgres database that I'm told it has privileges to create new users and grant them access to tables. This is half true. I wish to create a new user: create user ...
2
votes
1answer
116 views

Error 42P01: relation does not exist

I'm new at creating databases, and this error has me dumbfounded, as I am super new with DB admin things (I mostly do reporting type queries). I created a new database through pgAdmin3 GUI, and I'm ...
0
votes
0answers
46 views

How to load multiple files into a foreign table in POSTGRESQL?

I have several files starting with file_*.dat and I want to load these into one foreign table. I created the extension and server: file_fdw and file_server. I created this table - CREATE FOREIGN ...
0
votes
2answers
46 views

How can I find table name for each row result?

How can I find the table name for each row result in my query? I have tried ideas suggested on the stack network (overflow, dba) 1 How to make a table name an attribute in PostgreSQL? 2 ...
1
vote
1answer
21 views

psql with '-c' option or '-f' option is not terminating properly

When I run a command such psql -d database -c 'select * from table' or psql -d database -f sqlcommands psql does not terminate cleanly. Interestingly piping the the contents of the file instead of ...
0
votes
1answer
50 views

Install PostgreSQL using source code or using apt-get?

I want to install PostgreSQL on a server that runs Ubuntu 14.04.2 LTS. I understand that I have two options: 1) Install PostgreSQL using the source code distribution e.g., ...
0
votes
1answer
71 views

Memory usage on select for large number of rows

I am trying to dump the entire contents of a large table, from the command line using pqsl, but am running into a problem where memory usage goes up, to the point where the process is killed, before ...
1
vote
1answer
27 views

PostgreSQL: restore a record from a backup

We have a Rails app backed by a PostgreSQL DB and hosted on Heroku. We recently had a bug that deleted some (very few before we caught it) records. Excuse my ignorance but is there a straightforward ...
0
votes
1answer
37 views

Select records as groups based on sequence and date

I have data stored as: CompID | Seq | Udate | Utime --------+-----+-----------+------- mx433 | 1 | 1/1/2012 | 13:54 mx433 | 1 | 1/2/2012 | 13:43 mx433 | 2 | 1/4/2012 | 14:23 mx433 ...
2
votes
1answer
39 views

Does postgresql pl/lua language have luajit performance?

I am trying to use postgresql for a financial system and I need the best performance I can use, so I decided to use stored procedures for managing all the math and logic of the system. I have read ...
0
votes
1answer
132 views

pgAgent : how to configure pgpass.conf for a local connection on Windows Server 2008

I try to configure pgAgent on Windows server 2008 to make automatic backup on the database. pgAgent is installed on the server and the service is running normally. I use PgAdmin3 and PostgreSql 9.3 I ...
0
votes
0answers
23 views

Does installing some PostgreSQL options create some related tables?

After restoring an old pgsql database tables I realized that it contains tables like pg_ts_cfg, pg_ts_dict, geometry_columns and spatial_ref_sys. I can't remember creating those tables and I wonder ...
1
vote
1answer
68 views

How to create Postgres DB with case insensitive collation

I am using the postgres version 9.4.1 64-bit on windows 7 64-bit. I need to create DB with the setting "case sensitive = OFF" but couldn't make this work. I refereed already many question on SO and ...
2
votes
1answer
46 views

What is the relevance of 'SET default_with_oids = true' in a Postgresql dump?

I have an SQL backup from an old database which may have been a PostgreSQL 7 or 8 database I am importing which contains a SET default_with_oids - true statement, into a an existing 8.4 database and ...
0
votes
1answer
52 views

How to handle user with no password in postgresql

I installed postgresql but it's asking me for passwords that I never had and never entered. There is a postgres ubuntu user and a database user named moodle. Neither of these were created with a ...
2
votes
1answer
56 views

Postgresql performance issues when issuing many small inserts and updates one at a time

I have a production web server with postgresql database. My server gets data from another server every hour on the hour. The other server wakes up and sends many requests to my server, each result in ...
-2
votes
1answer
32 views

Replace date function call with its functionality [closed]

I have zero knowledge of postgresql somehow I have to extract data from a postgresql database I am trying to replace function call in a query with its functionality. Function: -- Function: ...
0
votes
2answers
65 views

unable to run postgres with pg_ctl

I was reading a postgresql book (PostgreSQL from Novice to Pro) and it says you can start the postmaster daemon by invoking the postgres binary which was part of the installation: ...
0
votes
1answer
27 views

Is it possible to access column by index instead of it's name/alias in query?

I want do something like this: SELECT * FROM ( SELECT 1, 2, 3 ) AS subquery WHERE subquery[0] = 1 -- I want to reference cloumn by its index in row
0
votes
2answers
53 views

Speed up SELECT with WINDOW, (PARTITION … ORDER) with compound index

I have the following table: CREATE TABLE ranking_points ( id serial NOT NULL, store_id integer, book_id integer, list_name character varying(255), rank integer, created_at timestamp ...
0
votes
1answer
59 views

Postgres automatic insert time stamp with time zone (india) [closed]

Is there any way to insert timestamp with zone automatically when query is inserted ? (just like id auto increment as i don't want to pass the the parameters in sql as time its same every where if we ...
10
votes
3answers
150 views

Combining separate ranges into largest possible contiguous ranges

I'm trying to combine multiple date ranges that may or may not overlap into the largest possible contiguous date ranges. For example: Data: CREATE TABLE test ( id SERIAL PRIMARY KEY NOT NULL, ...
1
vote
1answer
43 views

Is there something I can do to make this UPDATE run faster?

I have a relation EnumeratedSensorReading that includes a siteid and a quantityid column. I want to replace these two columns with a single sensorid column. I have added this column, and it is ...
0
votes
1answer
48 views

I want to start the Postgres database

I run this: $ postgres -D foobar It just hangs. There is no error message. I newly created this database with the initdb command. What should I do?
1
vote
1answer
31 views

postgresql - granting schema to users

I have (2) postgresql databases. I basically used the same pg_dump export file to create the (2) db's on different machines. The DDL is the same, however, I am getting the no relations message on one ...
0
votes
1answer
64 views

Put Postgres query result in array

How can I put an sql query result in a string array with Postgres? I have some attributes in the column 'zone' of the table 'mytable' and I must put them all in a String[] areas; This is my first ...
0
votes
1answer
39 views

Is it possible to set a timer for autovacuum in PostgreSQL

I am running PostgreSQL 9.4.1. I am currently cleaning up data, which requires me to run expensive queries. It seems like my tables get "locked" up every day at the same time in the afternoon. My ...
1
vote
0answers
31 views

postgresql pg_dump no matching schemas [closed]

I have a local postgres 9.4 installation with pg_dump. I am trying to do a remote pg_dump where I'm looking to dump only the schema DDL with NO data. I am getting the error: pg_dump: No matching ...
1
vote
1answer
56 views

How to atomically replace table data in PostgreSQL

I want to replace the entire contents of a table, without affecting any incoming SELECT statements during the process. The use case is to have a table which stores mailbox information that is ...
0
votes
1answer
62 views

postgres fetch record from partitions without the check constraints

I am using postgres 9.4, I have a messages table that has 100M records, messages belongs to one feed_id, so I decided to partition the tables by posted_at. Table "public.messages" ...
0
votes
0answers
41 views

What's the greatest value for postgres maintenance_work_mem?

I set 1960MB successfully for maintenance_work_mem, and got about 30% performance improvement on my COPY batch inserts. So I'm trying to run the import with even more mem (my machine has 32GB). ...
0
votes
0answers
66 views

How to run pg_bulkload on windows?

Is it possible somehow to run the postgres batch tool pg_bulkload on windows? I could not find any documentation on this, only for linux. Though it should be possible as the docs state: If you ...