Tagged Questions
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.
4
votes
0answers
136 views
Error in an after hook, PG::InFailedSqlTransaction from Rspec
I was trying to run rspec from a model spec file, but I got this error: "An error occurred in an after hook"
"An error occurred in to after hook PG :: InFailedSqlTransaction:
ERROR: current ...
4
votes
0answers
547 views
Postgres on Heroku - Intermittent Errors
After migrating an existing Rails 3 app to Heroku, I am getting a lot of intermittent Postgres errors reported to Airbrake. In particular, a bunch of these errors occur every few hours: ...
3
votes
0answers
81 views
Rails query slow but fast in pgAdmin
I'm trying to figure out why one of the queries in my rails app is under performing quite considerably. I'm using Postgres 9.3, and rails 4.0.3 with jRuby 1.7.10 so potentially it's an issue with the ...
3
votes
0answers
63 views
case insesitive openlayers filter not working
I have the following filter in openlayers 2.13
var filter_c = new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LIKE,
property: 'strToLowerCase(p_name)',
value: ...
2
votes
0answers
37 views
postgresql two nested joins and arrays in join
I've never had to ask an SO question before, I always eventually stumble upon what I'm looking for through searching, but there's a lot going on here and I've gotten to the end of my searching ...
2
votes
0answers
34 views
Create a dynamic alert box in ASP.net C# using a database listener which can be triggered without using a button click
I have a ASP.NET web site and i need to create a custom alert box which can be triggered without using a button click but using a database listener.(I'm using PostgreSQL database.) since I'm new to ...
2
votes
0answers
81 views
rake db:migrate does nothing in Rails 4.1 app - exits without errors
I'm setting up a brand new Rails 4.1 app. Everything goes smoothly until I run my first rake db:migrate command. Nothing happens. I ran trace - it doesn't look like it's processing my migrations but ...
2
votes
0answers
39 views
Postgresql import with COPY - ERROR: invalid input syntax for type date
I am trying to use Postgresql COPY and import a file into a database. The first field is a date field. Still I get an error:
Error : ERROR: invalid input syntax for type date: "2014-01-24"
...
2
votes
0answers
47 views
Gem install pg: Could not create Makefile
When installing pg I get the following error:
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for ...
2
votes
0answers
57 views
How to specify an ActiveRecord attribute for a timestamp when the column name has spaces?
I have a column in my postgres database like this:
"Last Execution Timestamp" timestamp without time zone,
Literally a column name in quotes with spaces, for timestamp.
How would I set and get ...
2
votes
0answers
52 views
passing parameter value through pgoledb to postgresql stored function
I am attempting to migrate a legacy client-server GIS application from Microsoft SQL Server to PostgreSQL. In this system the SQL Server database contains a large set of T-SQL stored procedures, each ...
2
votes
0answers
42 views
Django select_related with join on multiple fields
I have a somewhat complex database in django. It makes extensive use of partitioned tables. I have had some problems before with django and partitioned tables but so far I have found satisfactory ...
2
votes
0answers
72 views
Doctrine2 drive me crazy with OneToMany and ManyToOne relationship
I try to work Doctrine2 Mapping out but after 8 hours of problems I really need your help, please.
I have 3 PostgreSQL table, The first one is house
Column | Type | ...
2
votes
0answers
37 views
what difference between privileges in posgtresql?
new on postgresql DBMS.
after a \l command we have an output similar of this:
postgres | postgres | UTF8 | it_IT.UTF-8 | it_IT.UTF-8 |
template0 | postgres | UTF8 | it_IT.UTF-8 | ...
2
votes
0answers
107 views
(Solved) Rails 4 custom 404 causes postgresql connection failure on Heroku
I have a Rails 4 app deployed on Heroku in production with a custom domain. I also have a staging version. The app uses Comfortable Mexican Sofa.
The following problem occurs: The app will reach a ...
2
votes
0answers
153 views
“Rake spec” failing most tests, but “rails s” working fine on Diaspora source
I've got source of Diaspora cloned and I've got a working local pod that seems to run without a hitch. But when I run $ rake spec some initial tests pass and then all of them start failing. Also, what ...
2
votes
0answers
140 views
Is it possible to use postgresql 9.3 json type in associations (belongs_to) as foreign_key
I have ruby on rails 4.0 and postgresql 9.3.
I have two models:
class Person < ActiveRecord::Base
belongs_to :address_city, :class_name =>'City', :foreign_key => "address['city_id']"
...
2
votes
0answers
60 views
Quickest way to load data from PostgresSQL to R
I’m planning to do some data analysis with R; the datasets are stored in PostgreSQL tables and some of them contain up to 2 million records. I thought this would not be a big problem for R and loading ...
2
votes
0answers
107 views
Duplicate values present in primary key column in postgresql
I have a table in which one of the columns is primary key and it is of data type citext.
Many threads will update the table, they are properly synchronized. Those threads write the data in ...
2
votes
0answers
154 views
How to query and index JSON data nested multiple levels deep in PostgreSQL 9.3+?
In PostgreSQL 9.3, I am storing some fairly complex JSON objects with arrays nested within arrays. This snippet isn't the real data, but illustrates the same concept:
{
"customerId" : "12345",
...
2
votes
0answers
109 views
Lots of Postgres errors in RSpec integration test with Zeus
UPDATE
None of these non-deterministic errors occur when running RSpec without zeus.
I'm getting random error behaviors from the pg gem in attempting to run my RSpec tests. It is ruining my ...
2
votes
0answers
356 views
JDBC, Elasticsearch and Postgresql Json data type [SOLVED]
Postgresql : 9.3.2
Elasticsearch : 0.90
jprante/elasticsearch-river-jdbc : 2.2.2
postgresql JDBC : 9.3-1100 JDBC 41
I'm trying to get a postgresql Json data type column into elasticsearch, ...
2
votes
0answers
66 views
How to use USING clause in Alembic/SQLAchemy?
I would like to change column type of the database from string to integer by using Alembic. If I use pure SQL, it achieves the goal:
alter table statistic_ticket alter column tags type bigint using ...
1
vote
0answers
12 views
Transfer entire database from postgresql to Greenplum server
I know that greenplum and postgresql are very similar; what I haven't been able to determine is if I can execute a pg_dump and then import the entire database as is into the greenplum server, or will ...
1
vote
0answers
28 views
Is this a good idea to store relations to many different tables in one field?
I have 4 basic models which are stored in following tables:
users
images
videos
posts
In application logic user may "love" image or url or post (for example user clicks little heart next to image ...
1
vote
0answers
6 views
pgAdmin III (Windows) - Sharing DB Connection Definitions
I'm trying to copy a pgAdmin III server list from a source machine (which has my established list) to a target machine (with pgAdmin newly installed). Both run Windows 7 Pro, the pgAdmin version is ...
1
vote
0answers
31 views
bumping the character limit on a varchar field which is used in a view
I have the following Rails Migration:
class ChangeCommentLength < ActiveRecord::Migration
def up
change_column :videos, :comment, :string, limit: 500
end
def down
...
1
vote
0answers
26 views
VACUUM cannot run inside a transaction block
My application has this code:
Connection connection = DriverManager.getConnection(url, userName, password);
connection.setAutoCommit(false);
try {
Statement statement = ...
1
vote
0answers
55 views
Postgres performs full table scan instead of applying other WHERE clause first
I have a PG query that is doing a full table scan when a (seemingly obvious) index should be used instead. It involves a join and IN as follows:
SELECT sequence.name
FROM sequence, annotation
WHERE ...
1
vote
0answers
19 views
Django and postgresql running custom query timezone madness
I have a real issue with dates and running a custom sql in django with connection.cursor().
Currently every date I display to the end user I convert with .astimezone(timezone) but I have this custom ...
1
vote
0answers
12 views
what does in logic view of database R, C abrreviations mean?
RC mean on delete restrict on update cascade,
but what does the R and C mean?
does R mean that on delete and on update are restrict?
1
vote
0answers
38 views
Join 3 tables and filter
I am having trouble with my school project. First off, I have to make a big join and put that in a virtual table and use it later on.
Next, I want to make something where I join 3 tables and use ...
1
vote
0answers
32 views
translate postgres sql to linq. Is it possible?
I need translate next sql to linq is it possible? That will have approximately the same speed
SELECT Count(tblcollectionimage.lngimageid),
tblcollectiontree.lngcollectionid,
...
1
vote
0answers
21 views
PostgreSQL cast record to composite type
As known, there is a simple way to cast any record to corresponding composite type in PostgreSQL, like this:
CREATE TYPE test.t_test AS (
mytext text,
myint integer
);
SELECT ('text', ...
1
vote
0answers
22 views
Play or JPA adding unique constraints to my table
I have a one to many relationship between two models in Playframework 2.1.5. Here's the code :
@OneToMany(cascade={CascadeType.PERSIST, CascadeType.REMOVE})
public List<OperationInstance> ...
1
vote
0answers
33 views
Filtering a json type in a django model
I have a JSON field in a PostgreSQL 9.3 database. I'd like to be able to access it through a Django model. I've taken a look at django-jsonfield and jsonfield; however these do little besides ...
1
vote
0answers
37 views
UPSERT in PostgreSQL using jOOQ
I am trying to perform an UPSERT in PostgreSQL using the jOOQ library.
For doing this I am currently trying to implement the following SQL statement in jOOQ:
http://stackoverflow.com/a/6527838
My ...
1
vote
0answers
44 views
What is the SQL injection likelihood on a raw PostgreSQL JSON field query?
I'm starting to build an API using Laravel with PostgreSQL as the data source. From what I've read so far, Laravel's Eloquent ORM currently does not support querying indexed JSON (April 2014). For ...
1
vote
0answers
34 views
Complex sql query involving timestamp to timestamp periods and joins and sums - is it even possible?
I am trying to create database query, which will select rows from one table, create periods from those rows (using Lag window function), and join the query with rows from different table, where it ...
1
vote
0answers
51 views
Need help for some query problems in postgresql
How do I get correct results for the following questions:
Query the top 3 grades across all subjects. Show the subject code, subject name, and the grade. Sort the grade in descending order. ...
1
vote
0answers
20 views
Running Postgres stored procedure from JPA which accept an array as a parameter
I want to run a Postgres stored procedure from the EclipseLink 2.5.1 version which accepts as a parameter an array of UUIDs.
I couldn't find any example for such a thing online.
Is it possible?
...
1
vote
0answers
25 views
Postgres/base in Ubuntu using Symlink Error
I try to symlink Postgres/base to another drive because the base drive is out of space.
I followed this:
"Stop the server.
Copy the datadir while retaining permissions - use cp -aRv.
Then ...
1
vote
0answers
82 views
Testing ActiveRecord against multiple databases in Travis (without dummy rails apps)
I'm currently working on getting the activerecord_any_of library set up to use TravisCI for automated testing across multiple database types.
Currently I have the following:
In .travis.yml
...
1
vote
0answers
33 views
How to make PostgreSQL with Hstore work in a Sinatra simple app?
I am trying to make hstore work with sinatra 1.4.4 and sinatra-activerecord (1.5.0) in a Postgre database
I work with ruby-1.9.3-p392 with the gems
gem 'sinatra'
gem 'thin'
gem ...
1
vote
0answers
73 views
pg_config not found in path with brew
I am trying to install gdal with brew on OSX Mavericks. However, I get the following error:
brew install gdal
==> Installing dependencies for gdal: liblwgeom, libspatialite
==> Installing gdal ...
1
vote
0answers
23 views
Best alternative for FOUND_ROWS() in PostgreSQL
I was searching on NET for alternative to MySQL FOUND_ROWS(), how to get all rows when using limit and WHERE. I need this for pagination.
I found a few different approach, but I don't have much ...
1
vote
0answers
25 views
Linear regression in PostgreSQL
Please help me figure this out, spent hours with regr_slope and others regr_...
There are some values in value column, which are blank (null), I need to fill them in using linear regression.
Each ...
1
vote
0answers
75 views
Seam upload and download using s:fileupload not uploading or downloading
I'm trying to upload a file to a postgresql database however when I select the file is just does nothing after clicking upload.
attachment.xhtml
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML ...
1
vote
0answers
30 views
randomize query result if no is order given
I guess there a some places in my django code where we don't do explicit ordering of the DB query.
Of course this is no bug, sometimes the order does not matter.
But since PostgresSQL returns the ...
1
vote
0answers
34 views
How to use withTransaction in grails to insert list of objects?
I am using grails dbm plugin to insert records with in transaction so that I don't need to use 'flush:true'.
But somehow it hangs & does not go forward. This used to work fine without ...