PostgreSQL is an 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. Questions concerning administration or advanced features are best ...

learn more… | top users | synonyms (3)

0
votes
1answer
15 views

calling SQL by webservice, but it doesn't work

I got a problem with my codes. I wrote a simple java application connected to postgreSQL, code at below, it's work. package jdbctest; import java.sql.Connection; import java.sql.DriverManager; ...
0
votes
1answer
5 views

Add a Foreign Key in PgAdmin

I have studidtemplates table below: template_id is the primary_key I want to create a new table referencing template_id as a foreign key. It is named studidtemplatetextelements. See image below: ...
1
vote
0answers
8 views

How to add a custom DataType in Sequelize ORM

I want to define a custom data type in Sequelize by inheriting all default behaviours of existing DataType.Integer. The base idea here is to define a new type and override valueOf and toString ...
1
vote
0answers
6 views

Using postgres column value in psql query with python function

Hi am trying to return all values from my Postgres database which have expired, where the expiry time is defined by the user, this value is defined in the column "lifetime". I have attempted to do ...
0
votes
1answer
10 views

JPA where in embeddable optimization (Hibernate, PostgreSQL)

I have built a simple Query that returns a result list by searching an @Embeddable field with a list of possibilities. The query is: select d from data d where embedField in :embedValues It works ...
-3
votes
0answers
16 views

Best practice of data preprocessing [on hold]

what's the common way to preprocess data in a data mining context? I have to work with a PostgreSQL database and I'm looking for a good way to "play around" with the data. Things like filtering ...
0
votes
3answers
18 views

JPA Entity relationship?

I have entity called Shop and different types of shops (sport, clothes, tech...). That list of types will probably be predefined. One shop can have multiple types. What is the best way to represent ...
0
votes
1answer
20 views

Standard SQL and JOIN ( SELECT … )

In MySQL I use a lot constructs which look like this: LEFT JOIN( SELECT field_one, field_two, field_three FROM ( SELECT field_one, field_two, field_three FROM table_one ORDER BY ...
1
vote
1answer
29 views

Problems with my attempt to implement an UPSERT

I'm having this problem when checking a condition to update a table in PostgreSQL. It has to check if the user download this once and if yes, add +1 in acessos. <?php $result2 = pg_query("SELECT * ...
0
votes
0answers
23 views

JSONB object field as number or boolean (without text-casting need)

Now with a complete JSON operator set in pg9.4 and JSONB type, is expected to be use JSONB as a part of "PostgreSQL algebra"... Not JSONB as an "isolated universe"... In performance terms, JSONB is ...
0
votes
1answer
25 views

Linking libpqxx from Visual Studio 2015 on Windows 10

I've recently decided to try out PostgreSQL as the database platform for some C++ development I'm working on. I decided to use libpqxx as the connection library for my project, and quickly found out ...
6
votes
0answers
41 views

PostgreSQL 9.5 - Row level security / ROLE best practices

I'm tying to grasp the best way to use the new row level security feature in a multi-tenant database that supports a web application. Currently, the application has a few different ROLEs available, ...
0
votes
2answers
22 views

Postgres (Amazon RDS) how to calculate weighted average

I am using an Amazon RDS Postgres database (9.4.4), and I would like to calculate the weighted mean of some data. I have found the following extension which looks perfect for the job. ...
1
vote
2answers
23 views

Simple way to reset Django PostgreSQL database?

I was able to reset a Django PostgreSQL database using the following steps: Delete migration files Enter psql command prompt. Connect to database. drop schema public cascade; create schema public; ...
0
votes
1answer
15 views

PostgreSQL - Readonly “SuperUser”

I am searching for a solution how to create a postgres role, which can connect to all databases(also those being created after the role). Thats normally something a superuser can do, but in my case, ...
0
votes
0answers
13 views

Unable to migrate, django.db.migrations.exceptions.MigrationSchemaMissing

I have no valuable data in my database and was unable to migrate, as you can see here: ResetDjango postgresql database? flush does not work I tried to reset the database using: Delete ...
2
votes
1answer
27 views

Can I avoid a relation loop in my database design?

I try to design database tables for the case shown below. I also have an account defined, but it's not important regarding my problem. There is a list of operations (expenses). Each operation can ...
0
votes
1answer
11 views

ResetDjango postgresql database? flush does not work

I have made changes to my model and tried to migrate the database using: python3 manage.py makemigrations python3 manage.py migrate I got the following output: ...
0
votes
2answers
49 views

How to get the latest 2 rows ( PostgreSQL )

I need your help to modify a query to accomplish the requirement. According to the GATHER_TIME, I want to show the VALUE of the NAMEs. The query runs every 1 minute, and it should get 2 rows all the ...
1
vote
0answers
8 views

Collecting large statistical sets with pg_stat_statements?

According to Postgres pg_stat_statements documentation: The module requires additional shared memory proportional to pg_stat_statements.max. Note that this memory is consumed whenever the ...
1
vote
1answer
14 views

Trouble using postgresql and rails?

So at first I thought I would be able to solve this problem with existing questions and answers but none of the solutions seem to work for me. I installed the PG gem successfully with gem install pg ...
1
vote
2answers
35 views

Create Function: Syntax Error at or near $$

I'm a beginner in Postgres and I want to automate dropping a column from a table with a function. But it gives me the error I mentioned in the title. Here's my code: create function ...
0
votes
1answer
15 views

Django/postgresql: DETAIL: Failing row contains (43, , 1, 2016-01-02, 31, null, null)

I am attempting to submit a comment like so... Comment.objects.create(content = comment, post = post, user = request.user) When I do this I am getting the following error... IntegrityError at ...
2
votes
3answers
30 views

Custom SERIAL / autoincrement per group of values

I'm trying to make a blog system of sort and I ran into a slight problem. Simply put, there's 3 columns in my article table: id SERIAL, category VARCHAR FK, category_id INT id column is obviously ...
0
votes
2answers
18 views

How to access content of declared Variable in python in my POSTGRES sql query

I am just getting my hand dirty with python, hence my question might look silly. Yeah, I have the following code as per of a class. The declared variable in python was to accepted input from the user ...
1
vote
1answer
16 views

Drop a table in Postgres that is referenced by another

In MySQL I have a nice way to suppress key checking, I just do it like this: SET FOREIGN_KEY_CHECKS = 0; After that I could easily drop any table. I thought, that in Postgresql I could do the same ...
1
vote
1answer
14 views

Display postgresql dates on java Jtable

I'm facing a small issue with SQL dates and java which I already search the world on internet about this. The thing is that my program must load all the dates from a SQL table to my Java jtable. I ...
0
votes
0answers
27 views

Rails double joins and where

I got problem with multiple joins clause. Structure looks like: User < ActiveRecord::Base Investor < User has_one :investor_profile has_many :negotiation_processes, through: ...
0
votes
0answers
22 views

Rails 4.2 + Postgres not equals != <> on INNER JOIN on polymorphic association

I am trying to return all Posts that belong to an Hnode and that have not been hidden by the user. I have a 'hides' table that allows a user to hide a post. Hide is a polymorphic association ...
0
votes
0answers
15 views

Connect session in PostgreSQL with SailsJS

I have a personal project in SailsJS, Passport-Local and PostgreSQL. I managed to get connection and save users in PostgreSQL DB. But I have big problem with session storing. From what I know SailsJS ...
-6
votes
0answers
25 views

i am developing a rails application which executes a python script [on hold]

i am new to rails ,i am developing an application which has a worker ,the worker executes a python script present inside my rails application directory. the script generates a json file as output, ...
2
votes
2answers
37 views

How do I port query with GROUP BY clause to PostgreSQL?

I'm porting a simple expense database to Postgres and got stuck on a view using GROUP BY and multiple JOIN clauses. I think Postgres wants me to use all the tables in the GROUP BY clause. Table ...
-1
votes
1answer
20 views

SUM Data if Duplicate in Postgres

I am having table with three columns and may have duplicate data in it. what I am trying to do is if BATCH Column is having Duplicate Data then START_S and END_S should be according to below Example ...
3
votes
1answer
32 views

Do I need additional gems or maybe need to run a prior version of a gem?

Do I need additional gems or maybe need to run a prior version of a gem? I am using cloud9 and trying to deploy on heroku. I have added 'pg' gem (specifically '0.17.1' and gem 'rails_12factor', ...
1
vote
1answer
26 views

How to connect to postgresql in a multithreaded C application

I have a few threads in my application. Each has its own PGconn* connection that is individually opened with the same connection string. When a thread makes a query, it almost never returns ...
0
votes
1answer
29 views

How to alter the mount point of PostgreSQL through Docker?

I want to spin-up a docker for postgres:latest but let the data be stored on the host. This is how I do it right now but doesn't seem to work. Any ideas? docker run --name name1 -e ...
0
votes
1answer
24 views

Too many command-line arguments when calling pg_dump from java

After running into an issue on executing some queries as strings in Java for postgres, I went using string arrays, which solved my existing issues. After the switch I am now having an issue with ...
0
votes
0answers
21 views

pure postgres performance in rails on a banana pi

I'm current a running a rails app in production on a banana pi (m1) and I'm getting big performance issues. For example a really easy query where I'm getting all members (currently about 130 rows) ...
0
votes
0answers
18 views

Saving an example picture in the database in Scala Tests

I have started to develop in BDD by using Scala test. In my program I'd like to upload a file and save it in the Postgres database. So now I came accross the problem, that I don't know how I can ...
0
votes
1answer
65 views

Increment id using sub query

This is in reference to this question Grouped result insert into two tables I have the following schema create table master ( master_id serial primary key, project_id int, category_id ...
0
votes
1answer
9 views

Is mono.security.dll not needed in new 3x version?

downloading new version of npgsql i could See is not compiled old mono.security dll file. Is Not needed in newest version? I have not to ad any reference to this library if i use 3x version? Thanks.
0
votes
0answers
17 views

how to implement distributed database in pg admin3

Hi i would like to know how to setup distributed database using pg admin 3 , so that our team can view database changes without importing and exporting to their machine.I have done the same method in ...
1
vote
0answers
29 views

Index not being used in SELECT query [migrated]

I have a table of about 3.5M rows with the follow format id (int, PK) type (varchar) references (jsonb) createdAt (timestamp) The id is just an auto incrementing integer. The type ...
0
votes
1answer
45 views

Puppet PostgresQL management

I am trying to provision an EC2 instance using puppet. In the process I have downloaded the puppetlabs-postgresql module from puppetlabs. Since I'm fairly new to puppet, i do not want to manage my ...
2
votes
1answer
45 views

Can't upload clojure web app with postgresql to google app engine

I am trying to upload clojure web app with postgresql to google app engine. but I have a problem with uploading wep app. and this is tutorial I saw ...
2
votes
1answer
36 views

Why does this simple query not use the index in postgres?

In my postgre database I have a table named 'product'. In this table I have a column named date_touched with type timestamp. I created a simple postgre btree index on this column. this is schema of my ...
0
votes
1answer
29 views

Inner join in postgreSQL getting duplicate rows

I have 2 SQL query. query 1 select file_number_fk,sent_date as submitted_date from fl_file_movement where sent_by_post_fk='735' and file_number_fk='98223' query 2 select ...
2
votes
1answer
36 views

Parent id is not set while updating parent

I have two models class Parent < ActiveRecord::Base has_one :child accepts_nested_attributes_for_child :child end and class Child < ActiveRecord::Base belongs_to :parent validates ...
1
vote
1answer
8 views

PostgreSQL 9.3: Add/Remove QUARTER to/from timestamp

I want to add the QUARTER to the TIMESTAMP in PostgreSQL 9.3 version. My Try: For adding: SELECT TIMESTAMP '2016-01-01' + INTERVAL '01 QUARTER'; For remove: SELECT TIMESTAMP '2016-01-01' - ...
3
votes
0answers
37 views

Enable the query cache in postgreSQL to improve performance

My application is very database intensive so I'm trying to reduce the load and database as well. I am using PostgreSQL as database and python is language. To reduce the load of caching I already using ...