Tagged Questions
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.
0
votes
0answers
9 views
Can two out of three postgresql databases on localhost disappear without trace, or what did I do?
I am using postgresql 9.3 with pgadmin III, and Access 2013 as a front end for data entry using (ODBC connection) linked tables, on a Windows 8.1 (64). This is on a laptop with wireless I use in an ...
0
votes
0answers
7 views
Rails group query in mysql and postgres
I was running a rails app in mysql, and was 'working', but I'm having a problem with a query, in mysql this was working ok:
@package.requirements.group(:warehouse_id)
But in postgres, it's raising ...
0
votes
0answers
4 views
About .Net C # and communication JSP and PostgresXL repository
if my application has .Net C # MVC application and JSP application, how can I PostgresXL database and communication?
I saw [libpq - C Library] only on the official website of the library, I want to ...
0
votes
0answers
7 views
Which is the best PostgreSQL ORM for Nodejs? [on hold]
I am developing a sails.js app. I am planning to use PostgreSQL. What ORM do I use? I do not want to use Waterline because of the collection query limitations. Sequalize has 400+ open issues which is ...
0
votes
0answers
15 views
Connect to Postgres via SSL using R
I have the same question that was asked here Connect to Redshift via SSL using R
However, the answer given requires certificate validation. I'm wondering if there is a way to do this without ...
0
votes
0answers
11 views
org.hibernate.QueryException: Not all named parameters have been set: [toMonth, fromMonth]
I am working with PostgreSQL as DB and extjs for frontend on creating a report with datepicker and monthyear picker... Problem is i have created a report with datepicker but when i specify the ...
0
votes
2answers
27 views
Parameterize an SQL query in Python
I am trying to build a python script that will run a COPY command in a database connection while accepting parameters.
Database: Amazon Redshift, connecting with the psycopg2 package.
COPY command ...
2
votes
2answers
24 views
PostgreSQL not using index on a filtered multiple sort query
I have a pretty simple table
CREATE TABLE approved_posts (
project_id INTEGER,
feed_id INTEGER,
post_id INTEGER,
approved_time TIMESTAMP NOT NULL,
post_time TIMESTAMP NOT NULL,
PRIMARY ...
1
vote
1answer
19 views
When should one vacuum a database, and when analyze?
I just want to check that my understanding of these two things is correct. If it's relevant, I am using Postgres 9.4.
I believe that one should vacuum a database when looking to reclaim space from ...
0
votes
0answers
15 views
Internal Server Error with Postgres and Python
I keep getting this error: "Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the ...
0
votes
0answers
16 views
Postgres full-text search performance for common words
I am struggling to improve the search performance when someone tries to query for something that is very common. I have a database that contains 5.3 million records with their mailing address, and a ...
0
votes
0answers
33 views
How to insert value of UUID?
I'm using anorm 2.4 in play framework 2.3 backed postgresql 9.4
Give a model like this:
case class EmailQueue(id:UUID,
send_from:String,
send_to:String,
...
0
votes
1answer
12 views
Ident authentication failed on PostgreSQL through SSH tunnel
I have PostgreSQL server and a seperate computer is a client of it. They are in one network. If I use psql command like
psql --host db_ip_address --port 5432 --user user base_name
connection goes ...
0
votes
1answer
12 views
Error while trying to insert data using plpgsql
I have the following plpgsql function:
CREATE OR REPLACE FUNCTION test_func(OUT pid bigint)
RETURNS bigint AS
$BODY$
DECLARE
current_time timestamp with time zone = now();
BEGIN
...
0
votes
2answers
41 views
Are these SQL input parameters vulnerable to injection?
I am working in Django 1.8 with a Postgres 9.4 backend. I am currently running the following query using django.db.connection:
cursor = connection.cursor()
codes = ['01', '02'] # these are actually ...
0
votes
1answer
15 views
How to connect to PostgreSQL in Heroku with Luminus?
I just created a Luminus app and it has two separate places where database access is defined. In project.clj for ragtime:
:ragtime {:migrations ragtime.sql.files/migrations
:database ...
1
vote
3answers
42 views
Is there a better way to write this query involving a self select?
I am looking for a "better" way to perform a query in which I want to show a single player who he has played previously and the associated win-loss record for each such opponent.
Here are the tables ...
1
vote
2answers
11 views
need help specifying potentially reserved words as strings in postgres query
I've been using mysql for close to 10 years, but have recently jumped into a project that's exposed me to postgres for the first time. Most of the differences aren't a bit deal, but I have been ...
0
votes
0answers
6 views
Set up a follower database on heroku to follow 2 databases(1 table from each)
I need to set up a replication database, that will contain User tables from 2 applications. From what I've been able to find, solutions like standby server is what I'm looking for. But the hard point ...
1
vote
0answers
18 views
How can I export images from a postgreSQL database?
I have a simple data table.
Schemas>resources>tables>image_data contains the columns
image_id(integer) raw_data(bytea)
How can I export this data to files named based on the image_id? Once I ...
1
vote
1answer
15 views
Postgresql Update JDBC
I want to update table:
id integer NOT NULL,
"first" character varying(255),
"last" character varying(255),
age integer,
CONSTRAINT registration_pkey PRIMARY KEY (id)
using method:
void ...
0
votes
0answers
12 views
I want to move the listbox one to another listbox and update the particular listbox value
Here, Below i used the code.
I am new in VBA.
I am trying to move the one list box to another listbox, but I am not able to update the database table. I am struggle on few days. Why this error came ...
1
vote
1answer
12 views
PostgreSQL: trigger to call function with parameters
In PostgreSQL, I'm trying to create a trigger that passes an argument to a function, but it appears that this operation looks for a function whose signature has zero arguments:
ERROR: function ...
0
votes
3answers
16 views
how to delete a table before importing it on pg_dump?
I'm trying to insert into another database table that I exported using pg_dump:
pg_dump -U postgres --column-inserts --data-only -t table3 -t table2 -t table 1 > c:/file database
The problem is ...
1
vote
1answer
13 views
@SequenceGenerator allocationSize 'duplicate key error' issue
I have a SequenceGenerator with an allocationSize of 5 (together with hibernate.id.new_generator_mappings=true). So from my understanding hibernate should try and return those values as new id:
a) ...
0
votes
1answer
15 views
PostgreSQL: Combine Count and DISTINCT ON
Given this table
| id | name | created_at |
| 1 | test | 2015-02-24 11:13:28.605968 |
| 2 | other | 2015-02-24 13:04:56.968004 |
| 3 | test | 2015-02-24 11:14:24.670765 |
| 4 | ...
0
votes
3answers
35 views
PostgreSQL: change order of columns in query
I have a huge query with about 30 columns.
I ordered the query with:
Select *
From
.
.
.
order by id,status
Now I want that in the result to present columns in certain way.
The id column will be ...
0
votes
0answers
20 views
Get data from database with node.js
I start node.js with simple node example.
My simple project provide that to get data(select * from bla bla bla) from db but i have a problem is as follows:
Error: No such database: hakan_billur
...
0
votes
0answers
35 views
scalikeJDBC + postgres - No suitable driver found for
I am trying to connect to postgres with scalikeJDBC
I have the following error message:
An exception or error caused a run to abort: No suitable driver found for jdbc:postgresql://localhost:5432
...
1
vote
1answer
20 views
How is it possible to work (transparently) with non standard sql types from pyspark DataFrame
Specifically: I use jsonb (binary json) fields in postrgesql database.
I want to be able to read and write DataFrames to these tables in a simple way.
However, spark doesn't have mappings for these ...
0
votes
3answers
30 views
Generate sequence numbers on PostgreSQL integer column
I have a table on PostgreSQL and 1000 rows in it. I have an integer column in my table that is empty. I want to populate newid with sequential, unique numbers a bit like a primary key.
Product
...
0
votes
0answers
8 views
Incompatible postgis 2.1 for postgresql 9.3.3 homebrew os x 10.10
I have upgraded from OS X 10.9 to 10.10 Yosemite. I was running postgresql 9.3.3 with postgis 2.1. I did not do a pgdump before upgrading to OS X 10.10 (I know, I know, kill me...) but I have the ...
0
votes
1answer
46 views
Prepared statements: Using unnamed and unnumbered question mark style positional placeholders
In SQL systems other than Postgres, such as MySQL for instance, prepared statements can use question marks ? as a placeholder for data in prepared statements.
INSERT INTO foo (id, name) VALUES (?, ...
0
votes
2answers
26 views
Django 1.8 psycopg2 import error
I have psycopg2 installed on my computer under C:\Python34\Lib\site-packages\psycopg2
If I use a postgresql database in a django project outside a virtual environment, I get no error.But, when I want ...
0
votes
1answer
21 views
Call stored procedure using method name in a variable in postgres
The following Statement show error
EXECUTE quote_ident('Calculate' || calc_type_row."Name") || '($1,$2)' USING calc_type_row."IntervalTypeId",'Meter';
Name, IntervalTypeId are column in a table.
0
votes
1answer
18 views
Postgresql: Change COUNT value based on condition
So this is my table in database:
Worker X have this work result BETWEEN '2015-06-01' AND '2015-06-06':
What I want to do is to count the number of work days but my condition is that if (nb_heures + ...
0
votes
0answers
14 views
No tables on heroku postgres even after backup restore successfull
I am new to this.
I have php server and postgres db on a local machine. After taking a backup of localdb via pgAdmin, i tried restoring it on heroku instance with the command
heroku pg:backups ...
1
vote
2answers
37 views
How many records created for each day of the week this year?
I have about 50k rows in a Postgres database that are users and when they signed up.
I am trying to understand how many users sign up for each day of the week since the start of the year, e.g.:
...
0
votes
0answers
25 views
django 1.7 migrate not updating database
I've run python manage.py makemigrations core which created the following file in /opt/project/core/migrations
0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ...
1
vote
2answers
31 views
PHP: Check if postgres connection is alive?
I have a code similar to:
$conn = pg_connect($string_connection );
while(true ){
check if $conn is alive
$result= pg_query ($conn,"SELECT * FROM foo");
do something
...
-1
votes
2answers
40 views
SQL: How to add a NULL value into the table and bypass the constraint check?
I have a table
CREATE TABLE user (
user_id INT,
user_name VARCHAR(100),
CONSTRAINT pk_user_id PRIMARY KEY (user_id)
);
How can I bypass the constraint and add a new user with NULL id?
...
1
vote
2answers
24 views
Importing Python file from PostgreSQL stored procedure [duplicate]
It is possible to have Python code in a PostgreSQL stored procedure. For example:
CREATE FUNCTION someProc()
RETURNS void AS $$
# Some Python3 code...
$$ LANGUAGE plpython3u;
But how can I ...
0
votes
0answers
22 views
django.db.utils.ProgrammingError: relation “auth_user” does not exist
When trying to do a syncdb in Django it fails with the follow traceback. I've tried deleting the schema and creating a clean one. migrate creates the migration but it never creates any of the tables ...
1
vote
1answer
25 views
Copying Python data types to Postgres
I feel like this is a very basic question, but I cannot find a comprehensive answer on this. I am wondering what is best practice for copying python data types, like lists or dictionaries, to a ...
0
votes
2answers
31 views
Postgresql: How to apply pg_dump --exclude-table-data patch?
I have a production server (ec2) with a Django App and Postgresql Database.
I make a DB backup everynight with pg_dump which backs up the tables data.
sudo -u postgres pg_dump --column-inserts ...
0
votes
2answers
19 views
Django 1.8 error: No database fixture specified
I was using an sqlite database and after applying python manage.py dumpdata I added the new postgresql database settings in settings.py
DATABASES = {
'default': {
'ENGINE': ...
2
votes
1answer
21 views
ERROR: must be member of role “” PostgreSQL
I need to change owner of table.
I created table:
CREATE TABLE example (some columns);
Then I tried to change owner:
ALTER TABLE database.expample OWNER TO "secondary";
and them I got this ...
0
votes
0answers
16 views
Installing postgres on Mac OSX - pg_filenode.map missing
I'm trying to install postgres on my computer for a django project I'm writing. I had a previous installation which I removed, but some of the stuff may still be messing with my current installation. ...
-2
votes
0answers
27 views
Scaling Database [on hold]
I need to store data for a large quantity of images including: poster, datetime, filelocation, location, and a few other things. I need to be able to query by poster or location (stored as numbers and ...
4
votes
1answer
30 views
What is this type 'literal' syntax in Postgres?
The Postgres docs say a cast should look like...
expression::typename
typename(expression)
cast(expression as typename)
But this works:
select date '2015-06-20';
What is that syntax? Where is it ...