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 ...
0
votes
1answer
10 views
Data At every nth Interval Using Postgres
I am filtering my data between start date and end End date.
What I am trying to do is I want to filter data between '31-12-2015 11:19:00' And '31-12-2015 11:25:00' with '2' minutes interval
CREATE ...
2
votes
0answers
17 views
Sequelize: join two times the same table
Background:
I have a table Users with a one-to-many relationship to Userlang. For instance:
userlang.id userlang.userid userlang.lang
+-----------+---------------+-------------+
1 ...
0
votes
0answers
10 views
Storing Images in PostgreSQL DB with iOS app
I currently have an iOS app in Swift. I would like to take photos in it and store it in my PostgreSQL database and also, when needed, retrieve them. What is the easiest and most efficient way to do ...
0
votes
2answers
24 views
Grouped result insert into two tables
I have the following table.
CREATE TEMPORARY TABLE temp_detail
(
purchase_order_detail_id INTEGER,
item_id integer,
qty numeric(18,2),
project_id integer,
category_id integer,
supplier_id ...
1
vote
1answer
25 views
Select Data At every 3 minutes from starting timestamp
I want to select data from table at every 3 minutes interval from the starting timestamp using postgresql.
31-12-2015 10:00:00
31-12-2015 10:01:00
31-12-2015 10:02:00
31-12-2015 10:03:00
31-12-2015 ...
0
votes
1answer
20 views
Get the id in a group by select query
I have the following table
CREATE TEMPORARY TABLE temp_detail
(
purchase_order_detail_id INTEGER,
item_id integer,
qty numeric(18,2),
project_id integer,
category_id integer,
supplier_id ...
0
votes
1answer
11 views
PostgreSQL 9.3: Pass values to only selected parameter in function
I have to table with four columns as shown below:
Table:
create table fortesting
(
cola int not null,
colb timestamp null,
colc text null,
cold int null
)
Now I want to create a ...
0
votes
0answers
12 views
Not able to create connection, pgadmin 3 with server in ubuntu
i am new to ubuntu. My problem is, can not able to connect Pgadmin with POSTGRES SERVER.
These are the steps which i followed to install server and Pgadmin,
1)To install postgres sql ->
"sudo ...
1
vote
0answers
14 views
NpGsql EntityFramework 6 - “An operation is already in progress”
I am working on a project to connect to PostgreSQL database using NpGsql EntityFramework 6. I am getting the exception in question heading, when I try to execute the query in GetAdminUsersCount:
...
0
votes
2answers
31 views
How to Dynamically create table in PostgreSQL from JSON data using Hibernate
I am creating a application in which I am receiving the data in JSON format from Jersey RESTServices.I need to dynamically generate the table using the JSON data and also want to store the values in ...
0
votes
1answer
9 views
postgresql Rails native gem extension failure
I am trying to create a new rails-api project. I begin with the following command rails-api new <name> -T -d postgresql, to which I receive the following:
Gem files will remain installed in ...
0
votes
0answers
16 views
PostgreSQL 9.3: Alter database to set User
I want to restore the Database in postgreSQL using the function.
In the function, I want to do the following steps:
First I want to alter the Database to the SINGLE_USER to access,
Restore the ...
0
votes
1answer
20 views
How to change primary key type from varchar to uuid without dropping foreign key
I have the following Psql table structure.
Table "public.kart_user":
Column | Type | Modifiers | Storage | Stats target | Description
...
0
votes
2answers
37 views
How to write a customed insert query?
I'm inserting comma separated data into database from the java code.one of the variable contains appended strings with comma separated. i.e.,
String e_hashtag_postion_text="Ericsson,+university ...
0
votes
0answers
8 views
How to serve websites that perform complex computations?
I am trying to create website on Django. This website will consider the user's historical transactions and serve the consolidation of those results. The consolidated results should not be pre-computed ...
0
votes
1answer
25 views
How to get records recursevly with condition in Postgresql?
I have two tables
locations:
locationid , parentid
1
2 1
3 1
4 2
5 4
8 1
and approvelog:
locationid approved
4 ...
1
vote
1answer
39 views
Cannot createdb in postgresql
I'm trying to start a Ruby on Rails app with PostgreSQL as the database because once this site is finished I'll be promoting it to another blog that has 259K followers and I just want to anticipate if ...
-3
votes
0answers
17 views
Java excel sheet update into database
Read excel sample columns (example name, address, phone number) every time I run my Java application using hibernate framework it has to update records in the database using postgresql. Share me some ...
0
votes
1answer
16 views
postgresql - distinct only on one column
I have a table called eatable. It has columns such as type, name.
type column has fruit, veggie, veggie, fruit, veggie values
.
name column has apple, brinjal, carrot, banana, cabbage.values
I ...
0
votes
1answer
22 views
How to extract values from a custom SQL query
I have the following custom query whereby I am trying to extract the values so they are meaningful for my app
@sizes = Product
.joins(:product_properties)
...
0
votes
1answer
17 views
Multi-dimension instance loop
I am trying to use a custom sql query to display different attributes for a product i.e. Size and Price. The query I have when running in console displays as it should
SELECT products.id, ...
1
vote
2answers
33 views
Two queries in one
How can I merge these 2 queries? I'm having a rough time writing this query.
1)
SELECT question_id, name, question_text FROM questions
WHERE ...
0
votes
0answers
8 views
How to connect PostgreSQL array and html params array in Rails
I need find movies with tags
I have PostgeSQL array
add_column :movies, :string_tags, :text, array:true, default: []
And i have a array in html params
tags[]=test1&tags[]=test2
How i ...
0
votes
0answers
8 views
copy/import local pg database to Heroku
I have working app let's call it CLUB on local host. CLUB has small-sized database. I hosted CLUB on Heroku, but I cannot get it to work as it misses the database.
I had previously connected CLUB to ...
0
votes
2answers
22 views
PostgreSQL nested select query
Ok. so I have 2 tables: questions and questions_answers
table 1 columns) question_text | question_id
table 2 columns) answer_text | question_id
I want to perform a query that retrieves each row ...
0
votes
2answers
10 views
Q: PostGreSQL How to Pass POST information in a SQL command more efficiently
I have a page that brings up a users information and the fields can be modified and updated through a form. Except I'm having some issues with having my form update the database. When I change the ...
2
votes
1answer
26 views
Incorrect sort/collation/order with spaces in Postgresql 9.4
I'm using Postgresql 9.4.5. When I go to psql and run \l I get
Encoding is UTF8
Collate is en_US.UTF-8
cCtype is en_US.UTF-8
I have products table with a name column that has the following names:
...
0
votes
1answer
23 views
What is the Postgres equivalent of SQL Server's If Exists(
I have a T-SQL query I would like to be able to use in Postgres. I'm new to Postgres and would like to know if the If Exists is possible as well as the Print or what the equivalents would be.
...
-1
votes
2answers
16 views
Starting Where Query Left Off in PostgreSQL
I have this code in groovy, and I am using PostgreSQL to access the database server.
If I execute this query, it will get logs from the starting point until the end. However, logs are continuously ...
1
vote
1answer
13 views
Rails Paginate Query with Subquery in Postgres
I have the following Postgres Query:
SELECT p.*
FROM unnest('{19082, 19075, 20705, 18328, 19110, 24965, 18329, 27600
, 17804, 20717, 27598, 27599}'::int[]) s(source_id)
, LATERAL ...
0
votes
1answer
7 views
search for a column that has a keyphrase in a string
I have a table with a keyphrase column. Given a string I need to find all rows in the table that the keyphrase is contained in the string.
For example:
I have a row in the table with the keyphrase ...
2
votes
1answer
14 views
postgres not using index when index scan is much better option
I have a simple query that joins two tables that's being really slow. What I am finding out is that the query plan does seq scan on the large table email_activities (~10m rows) while I think using ...
0
votes
0answers
10 views
French and Spanish characters getting junk value in Database
I am having a file in which there are around 1K Insert sql statement which contain a few french ,Spanish and mandarin characters in a property value column.I have made a shell script to run ...
-1
votes
1answer
22 views
Create Azure web site with Django and postgresql
I have django + postgresql web site.
I want publish them to Azure web site.
How I can sync db, or create postgresql database in azure web site?
If I can do it, what I need write in settings file?
...
0
votes
1answer
26 views
Specify Postgresql DB default collation for a Rails project
I have a Rails 4.2+ and Postgres 9.4 project and I need to change how Postgres orders items in a query. The default settings seem to ignore whitespace and I need a strategy that takes white space ...
1
vote
1answer
21 views
PostgreSQL Wildcard and sub select count
Having two tables , inventory and lots, i am using inventory table to save description of item including categories if items as well, filtered by the field inventory.type as inventory.type = ...
0
votes
0answers
6 views
Error when trying to use Postgres mysql_fdw on Windows 7?
I was following a tutorial in another question about trying to get the MySQL Foreign Data Wrapper (mysql_fdw) to work on Windows 7; when I get to the step in pgadmin III where I try to add an ...
0
votes
0answers
3 views
sqlalchemy with_hint not working
I'm trying to produce a query with the Postgresql ONLY keyword from SQLAlchemy expressions:
Example 1: Defining the table name with the text() expression doesn't work (except if I put the string ...
1
vote
2answers
40 views
How to use Row_Number() correctly
I'm running the following query on Postgres:
SELECT a.testscoreid,
COUNT(a.*) AS Questions,
a.created,
ROW_NUMBER() OVER (PARTITION BY Questions) AS Number,
b.irt_tlevel
...
1
vote
0answers
23 views
Python Django: Join on the same table
I'm trying to use ltree extension in PostgreSQL to build a full-text address search engine.
My model looks like this (it's slightly simplified):
from django.db import models
class ...
3
votes
2answers
16 views
How to get Dapper to ignore/remove underscores in field names when mapping?
There are many ways to map database field names to class names, but what is the simplest way to just remove the underscores?
public IEnumerable<PersonResult> GetPerson(int personId)
{
...
2
votes
1answer
16 views
case statement and group by not grouped correctly (postgresql)
How do I get correct grouping when a column not should be grouped. The query gets a wrong result
CREATE TABLE inv
(invid int, co int4, type varchar(1), sum int4);
INSERT INTO inv
(invid, co, ...
1
vote
1answer
38 views
How to merge and display data from multiple tables
Hopefully this is not too subjective, but:
I have a problem where I need to query data from four different tables based on an ID. This data has similar but not identical fields that need to be ...
0
votes
1answer
23 views
syntax to return value for error while preforming postgresql function
I am brand new to Postgresql and am trying to write a function that calls another function, and then returns -1 if that function had any errors. I am coming from a T-SQL background and essentially ...
0
votes
1answer
14 views
Execute PostgreSQL statements upon deployment to Elastic Beanstalk
I am working on an application that has source code stored in GitHub, build and test is done by CodeShip, and hosting is done in Amazon Elastic Beanstalk.
I'm at a point where seed data is needed on ...
3
votes
1answer
20 views
Retrieve data from JSON object
Have problem is selecting local_desc based on the langtype which is passed thru a procedure .
Sample table and data for your reference
create table test (local_id numeric, local_name json);
insert ...
0
votes
0answers
19 views
Design of unique column value reservation for two-step update
In our system changing of nickname (the unique column value in single row) should be performed with two steps:
Client requests the change. Server reserves the new value so it can't be reserved or ...
0
votes
2answers
17 views
insert additional column values(not available in file) in postgresql table using COPY
Table columns:
col1, col2, col3, fname, lname
CSV file contains values like:
col1,col2,col3
val1,val2,val3
val1,val2,val3
I want to add data from csv along with additional data i.e. ...
0
votes
1answer
28 views
Extracting specific values with Postgresql
I have a table like this:
Table
<!DOCTYPE html>
<html>
<body>
<table border="1" style="width:100%">
<tr>
<td>email</td>
...
0
votes
0answers
27 views
How to override js functions in odoo 8?
want to customize IM chat button in odoo 8. i want to make it invisible for others except one group so i have inherited js file into my module. original file is im_chat.js file.
if(openerp.web ...