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.
0
votes
0answers
6 views
Django creating object locks on tables (AccessShareLock)
I built an application using Django and am having problems with the locks my application is leaving behind. Am not using transaction decorators, so transactions should be committed at finish of ...
-2
votes
1answer
26 views
return only one row of a select that return a set of rows
I have a table on postgresql like:
create table myTab( id integer primary key, is_available boolean not null default true);
now i need to do a query that return only the first encountered row that ...
0
votes
1answer
9 views
Creating a table with a sequence of values without inserting each one manually
I (think I) want to create a view or temporary table that contains a sequence.
The purpose of this table is simply to provide values needed to make a panel data set.
What I would like to do is create ...
0
votes
1answer
19 views
Transferring two queries from MySQL syntax to PostgreSQL (tt-rss related)
I'm having some trouble with my tt-rss install - my DB got too big, so now purging is not working.
I've found a manual solution, but the query is for MySQL and i'm using PostgreSQL, so it's not ...
0
votes
1answer
8 views
Insert SQL with variables and variable is not changing in loop (vb.net, postgresql)?
I'm working on an app to insert data from a csv into a postgresql database. I populate a datagrid, loop through the datagrid and insert a record into the table (yes I know the code is pretty verbose, ...
1
vote
1answer
13 views
Rails has_and_belongs_to_many find unique objects in common
I have two models, Conversation and Phones, both of which has_and_belongs_to_many each other. Phones can have a lot of conversations, and conversations can have a lot of phones (two or more).
class ...
0
votes
1answer
27 views
File uploaded in postgres db
I'm new of vaadin and I'm developing my first application with spring and vaadin.
Now I'm trying to save an image inside my database. I followed the description of upload component on vaadin-book ...
5
votes
1answer
36 views
Passing column names dynamically for a record variable in PostgreSQL
Using PostgreSQL, column values from a table for 1st record are stored in a record variable. for ex: let the variable be: recordvar
recordvar.columnname
gives the value of the column name ...
1
vote
1answer
20 views
How can I write a down or reversible function in this migration?
So, in-case this migration causes any errors I'd like to be able to revert back/rake db:rollback.
The code:
class ChangeUidToPrimaryKey < ActiveRecord::Migration
def change
execute ALTER TABLE ...
0
votes
1answer
18 views
Trigger after update not working
I'm struggling to get my 'after update' trigger to work properly.
As seen from my simple query, the sum of the production_work matches the sum of the order elements.
# select ...
0
votes
1answer
17 views
Postgresql login through phppgadmin and terminal - ubuntu
I installed postgresql 9.1 and also installed phppgadmin in ubuntu machine.
If i login with phppgadmin it working fine with username: postgres and password: root
But when i try to access through ...
0
votes
0answers
18 views
nesting another field in a json column with a rails form
I'm trying to use the Json type available in the Postgres 9.2 release as a means to store a variety of data in one field. I created a column called data of json type on the corrections table. The form ...
1
vote
1answer
35 views
Optimized query with performance measurement (from mysql to) in postgresql
SELECT m.title , m.run_time FROM movie m WHERE m.run_time < (SELECT AVG (run_time) FROM movie) *1.1 AND m.run_time > (SELECT AVG (run_time) FROM movie) *0.9;
It costs 4.6 to 8 in postgresql
...
1
vote
1answer
19 views
Get repeated values
I have table like this:
I need get numbers, wich is repeated in different citys and also get these citys quantity for each number.
That is from this table, I need result:
number | repeated citys ...
1
vote
1answer
36 views
Quicker way to insert non-matching ids to column
Is there a quicker way to get the ids that exist in table1 but not exist in table2 and insert them in table2?
insert into table2 (id)
select id
from table1
where table1.id not in (select id from ...