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. Greenplum Database, Amazon Redshift, ParAccel, Postgres-XC, ...

learn more… | top users | synonyms (3)

0
votes
0answers
3 views

can you run two pgpool instances on a single host?

Is it possible to run two pgpool instances on a single host? We're working through configuring that now, just wanted to check that there's no commonly known "oh, no that will never work" out there.
0
votes
0answers
5 views

gitlab Error 500 after updating when viewing projects

dpkg-query -W gitlab gitlab 7.3.2-omnibus-1 We have gitlab 6.9.2 running on Ubuntu 14.04.1 LTS. After following the instructions found here ...
0
votes
0answers
10 views

Get all latest() from model

This is a pseudoview of my structure: Offer [id, match] - Odds [id, offer_id, time) - Odds [id, offer_id, time) - ..... To get the latest object based on the time attribute, I would ...
1
vote
0answers
12 views

PostgreSQL Base64 Image decode issue

I am having an issue converting an image stored as base64 in a PostgreSQL database into an image to display on a website. The data type is bytea and I need to get the data via cURL. I am working with ...
0
votes
1answer
10 views

Format postres numeric like money ($0.20)

I have a numeric column that I'm trying to format like currency, but I can't seem to get the format right. I currently have: to_char(my_column, 'fml9999999999999999999D9999999999999999999') but it ...
0
votes
2answers
20 views

PostgreSQL is ignoring my composite index

Here is the table in question and its indexes. This table in production contains ~ 50 million rows. CREATE TABLE "public"."audit_page_loads" ( "id" int4 NOT NULL DEFAULT ...
0
votes
0answers
19 views

Elasticsearch versus PGsearch versus simple sql like

I am having a Ruby on Rails application which has its search implemented using elastic search. It is using Postgresql as database. There are two tables ticket and ticket_message. One ticket has_many ...
0
votes
0answers
9 views

Sails. With “req.params.all()” I get error. How to setup the model with the correct “primaryKey” and everything just to be good for postgreSQL?

I'm following the SailsCasts episode and below are my code. Everything works if I use sails-disk or mongo. But if I use sails-postgresql I have this error. With "req.params.all()" I get error ...
0
votes
1answer
12 views

preceding nth row without self-joins

I have a large query that results in following: Date Cost ------------------ 6-Oct 24.05 5-Oct 34.56 4-Oct 24.76 3-Oct 12.89 2-Oct 11.34 1-Oct 21.76 30-Sept 32.89 29-Sept ...
3
votes
1answer
17 views

Wrong PostgreSQL query results with explicit locks and concurrent transaction

While writing some SQL queries for PostgreSQL, I discovered some unusual behaviour, which I find slightly disturbing. Say we have the following table "test": +----+-------+---------------------+ | ...
1
vote
2answers
27 views

Find duplicate records in large table on multiple columns the right way

I have read many threads on this subject now and tried a few things but it has not worked as I hoped. I need some clarification and apologize if this is considered a duplicate thread. A client of ...
0
votes
0answers
21 views

database connection error associated with the encoding

I have Spring + Hibernate application. I use PostgreSQL as data store. application compiles good but when I deployed it to Tomcat and launch it I see following stacktrace: INFO : ...
0
votes
1answer
32 views

How to select unique values from a single column, with a default scope, returning multiple columns

In a rails application I need to return an ActiveRecord collection containing multiple columns, but only 1 column must be unique. There is a default scope which is not the unique value. Default ...
0
votes
0answers
10 views

Inserting Bytes to Postgres with python gives error, but with PG SQL console works

I'm encrypting some data and trying to insert it into postgres as bytes. I'm using psycopg2 and python. When I try from python it gives me an error about varying character. Error value too long for ...
0
votes
0answers
8 views

faster way to calculate top “tags” for a “resource” based on a column

I've been able to fix most of my slow Postgresql queries into something more acceptable, but I haven't been able to shave any time off this one. I'm hoping someone can suggest a better strategy. I ...
0
votes
1answer
18 views

How can I revise this pl/pgsql functions?

I would like to have a PostgreSQL extension function which could first check if there is a row in table face_area(face int, area float), if there is none, calculate and insert into the table. The ...
0
votes
0answers
13 views

Export PostgreSQL data to MongoDB

Hello I fell parachute on a project that will use MongoDB and do the import of a base using PostgreSQL, this base possess several banks and has a total of 251 tables my questions are: 1 - From what ...
0
votes
0answers
14 views

How to handle postgresql connection problems

I have run into a number of cases where the postgresql connection is in a bad state. OK, I'll make this complicated by having a master with a couple of slave servers... And to complicate matters even ...
0
votes
1answer
21 views

looping through files for postgresql give error in windows

i'm trying to read files and load them all csv files, and once done move the files to some other location : cd E:\data\ for /f %%a in (’dir /b filename*.CSV) do ( psql -U postgre -W password -c ...
0
votes
1answer
31 views

SQL - group data by day

I have a table transaction with data as below: date | status | delivered | products ------------------------------------------- 03.10.2014 | SUCCESS | TRUE | 4 03.10.2014 | FAILURE | ...
0
votes
0answers
11 views

Restore postgres DB from JAVA application

I want to restore my postgres database from java application but I get this error: pg_restore: [programme d'archivage (db)] the connection to the database « certificat_test » failed : fe_sendauth: no ...
0
votes
3answers
54 views

How to count number of present employees in each month?

I am looking for SQL to count number of employees who were working in each month in that particular year. Means the result should be for QA department in year of 2013 like: dept_name Jan Feb ...
0
votes
0answers
14 views

jOOQ : compare uuid(from postgresql) and string(user id in class)

My backend is postgresql. I am trying to write a simple function to fetch data from database, using jooq records. The DAO for this table is written by me. The problem I am facing is comparison of UUID ...
0
votes
0answers
12 views

Encrypting and decrypted data before save in cakephp

I am creating a health clinic and portal application in cakephp. I need to insert encrypted data in database not using base64 encode and decode method and to use in search also. Can someone help me by ...
0
votes
1answer
13 views

Getting all records from database to Vaadin Table

Im trying to load records from database table to Vaadin table. Im getting all records from table process like this: public ResultSet selectRecordsFromDbUserTable() throws SQLException { ...
1
vote
0answers
40 views

Advises for handling a 200 GB CSV with geometry

I have a 200 GB CSV file that represent locations (points) around the globe. Each entry (row) has 64 columns and it has redundant information. I made some calculations and the size is approx. 800 ...
0
votes
0answers
6 views

Multiple rails3 applications conditional deployments

With an application that needs scaling, multiple instances of an application need to be deployed at different times. staging.theapp.tld (for admin testing) sandbox.theapp.tld (for user testing, ...
0
votes
1answer
28 views

Can`t run spark app because of java.lang.NoClassDefFoundError: org/postgresql/Driver

I can`t run mt Spark app because java.lang.NoClassDefFoundError: org/postgresql/Driver I did same like How can I connect to a postgreSQL database into Apache Spark using scala? but when I try to ...
0
votes
1answer
26 views

PostgreSQL MAX aggregate function applied to strings and Java resultset

Hello and thank you for reading my post. I have a PostgreSQL table "t" with a column "c" which type is "character varying(32)". Values in this column look like this: "2014100605". I am using the ...
0
votes
0answers
13 views

Openbravo - Connecting pgadmin with postgresql database in Ubuntu

I have installed Openbravo ERP 3.0 in Ubuntu 12.04(LTS). After completed the installation I tried to connect with postgresql database using pgadmin 9.1. I gave all the details as mentioned in this ...
0
votes
0answers
14 views

Which are the simplest way to do cross database references in pgAdmin?

I want to do horizontal fragmentation on a table say table employee(attributes) which is in 'Employee' database on 'server1' and such fragments are need to store in table on other databases on same ...
0
votes
1answer
49 views

SQL multiple natural inner joins

Why does this correctly return the Order ID of an order, the Customer ID of the person who made the order, and the Last Name of the employee in charge of the transaction SELECT "OrderID", ...
0
votes
0answers
9 views

Connecting to Amazon RDS

I have a PostgreSQL RDS server running, but the only way I can connect to it is using pgAdmin III. Connecting via psql command line just hangs forever. Using node.js pg library doesn't work either ...
1
vote
2answers
25 views

How to track query progress in PostgreSQL?

Is there a plugin or a script that can track the progress of long query in PostgreSQL? I mean I need to set progress bar value in Java that related to some update query in Postgres. I search over ...
0
votes
0answers
11 views

Rails hstore map of maps? [duplicate]

I'm using an hstore column: add_column :my_table, :entities, :hstore And I store in it a map of arrays: { likes: ['football','soccer'], post: [1,3] } However, when I load it from the DB, I ...
0
votes
0answers
9 views

Running Spatial Queries in PostGIS 2.1.3 and Postgresql 9.3 in Windows 7

I installed PostGreSql 9.3 ( PgAdmin 3 GUI) and PostGIS 2.1.3 (http://www.enterprisedb.com/products-services-training/pgdownload#windows) for Windows 7 64 bit. After installing it, I downloaded the ...
0
votes
1answer
15 views

pg_query_params return error when query contains a function

$Query = pg_query_params($db, 'SELECT username FROM users WHERE id = $1 AND password=(crypt(\'$2\',password)) LIMIT 1', array(33,'thepassword')); "bind message supplies 2 parameters, but prepared ...
1
vote
0answers
12 views

mongo listfield to postgreSQL fileds

I use scrapy and django with mongodb scrapy has an image_urls and images is dictionary so I save it as Listfield in mongodb and now I need to change the database form mongodb to postgreSQL because ...
-1
votes
1answer
21 views

PostgreSQL While Function

I am new in PostgreSQL. I have the following code (Stored Procedure) in SQL Server: Create function sp_test as Begin declare @cont int set @cont = 0 while (@cont<5) Begin if @cont < ...
0
votes
1answer
13 views

Momoko, Jinja2 and Tornado

there is something fundamentally wrong with my code. These are my tornado handlers with basic authentication and jinja2 as template engine. The following works without the momoko db parts. class ...
0
votes
0answers
16 views

force heroku / django to use local database

I have a django based herokuapp site. I set everything up a long time ago and am now unable to get things working with a local instance of postgresql. In my settings file, I updated: ...
0
votes
0answers
8 views

undefined method `fields' for nil:NilClass - ActiveRecord concurrency issues

I have a rack server handled by Puma and connecting to PostgreSQL via ActiveRecord. For database configuration I have the reaping_frequency set to 5, the pool set to 16, and connect_timeout set to ...
0
votes
1answer
22 views

Database Requirement Suggestion [on hold]

I did some research on the net and got stuck. So i decide kindly to ask for your experience and feedback. I have a project that requires keeping a lot of data on a RDBMS. Structure will be deviced ...
-1
votes
0answers
15 views

Pass django view Postgres SQL function name and arguments instead of using Models

My system doesn't make much use of django for anything except login and database access. I've decided I don't really want to integrate my system deeply into django, but rather depend on django as ...
0
votes
0answers
18 views

how to restore a postgresql database from a file? [duplicate]

I have a open source application downloaded , and they ask to restore a postgresql db from a file how to do ? here is the file : ...
0
votes
4answers
40 views

Rails has_many with an integer primary key and a string foreign key

I have three rails objects: User, DemoUser and Stats. Both the User and the DemoUser have many stats associated with them. The User and Stats tables are stored on Postgresql (using ActiveRecord). The ...
0
votes
1answer
25 views

How to connect to postgres with two terminals?

I have a terminal I can connect to postgres psql testdb but when I open a new tab or a new terminal and tried to connect to psql an error is returned This error returns psql: could not connect to ...
-1
votes
0answers
7 views

createdb in postgresql not working on Cygwin

I'd like to use the terminal functionality of Postgresql 9.3 in Cygwin. So, I want to create a database, and I run the following: createdb my_template ... and of course I get a createdb: command ...
3
votes
1answer
28 views

How to calculate max columns in Postgresql

I would like to know what is the correct way to calculate the max number of column in a postgresql table. It says on their website: Maximum Columns per Table 250 - 1600 depending on column types ...
0
votes
1answer
13 views

How to Group Postgresql and counting

Hello everyone i have database data like this date | text | link_id ------------+-------+---------- 05-10-2014 | lorem | 2 06-10-2014 | lorem | 4 05-10-2014 | lorem | 4 05-10-2014 | ...