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
2answers
7 views
Show only table names when viewing postgresql tables
So I have no idea how to do this and I've been reading the documentation and searching around but I can't seem to find anything. \d gives me a nice list of all the tables and information on them but I ...
0
votes
0answers
7 views
PostgreSQL reset tables to original state
We have a large PostgreSQL dump with hundreds of tables that I can successfully import with pg_restore. We are developing a software that inserts into a lot of these tables (~100) and for every run we ...
0
votes
0answers
7 views
Heroku + Rails 3.2 + PostgreSQL = NoMethodError: undefined method `result' for #<NoMethodError:..>
NoMethodError: undefined method `result' for #< NoMethodError: ...>
Stack trace refers to this place:
def current_income
return @current_income if defined? @current_income
if ...
0
votes
1answer
14 views
The best way to store sortable list in PostreSQL and Rails
I have a model A which has many B. So a.bs is a list of B. I want this list to be ordered by user. The common way is special order field in the database and then :order_by => order_field for B. But ...
0
votes
0answers
5 views
rake db:setup not work with Postgres and Postgis ERROR: could not access file “$libdir/postgis-1.5”: No such file
In Ubuntu, i try to run rake db:setup to install a Rails application, but i have several times this message ERROR: could not access file “$libdir/postgis-1.5”: No such file
Finding in the files, i ...
1
vote
0answers
5 views
PostgreSQL Cluster Startup Race Condition?
My software process depends on the existence of a specific database in the local PostgreSQL cluster. PostgreSQL and my software process are both started by upstart on system start. A script is ...
0
votes
1answer
18 views
Installing postgresql for Django
I installed postgresql and (I think) pyscopg2. I want to run postgresql with django. I tried the command "createdb mydb", and I got the error message shown below. What should I do?
could not connect ...
0
votes
0answers
6 views
django database routing with transactions
Referring to the example in Django documentation for multiple databases in one application,
https://docs.djangoproject.com/en/dev/topics/db/multi-db/#an-example
" It also doesn’t consider the ...
0
votes
0answers
12 views
PostgreSQL to iterate through rows and find the closest match using custom distance-function
I am new to PostgreSQL and my question is similar to the one here: link
For e.g I have the following table:
| id | vector |
| 1 | { 1.43, 3.54, 5.55} |
| 2 | { 4.46, 5.56, 4.55} |
...
0
votes
1answer
35 views
Postgres:Get the latest record from a table
I have two tables which I use to fetch data and from this data I want to identify the records which are lastest related to a particular value.
My first table is :
g_190048(
id,
...
0
votes
0answers
13 views
Loop through a table to fill an other one
I asked a question here fiew days ago: Order SQL request when each row contains id of the next one
But now I'm confronted to another problem. I would like to get all bus stops per ligne in the right ...
0
votes
0answers
10 views
Rails postgis adapter makes lot of queries in table “geometry_columns”
I'd like to optimize my Rails 3.2.13 application that's currently using postgis through activerecord-postgis-adapter gem.
The problem is that when I make a query in a table, even if there are only ...
0
votes
0answers
7 views
psycopg2 is mixing column names with values depending on the table selected
I query a whole postgres table using
c.execute("select * from train_temp")
trans=np.array(c.fetchall())
and amid the expected data I got one row with the column names.
trans[-1,]
Out[63]:
...
0
votes
4answers
63 views
SQL select values with or
Is it possible to make a query which does the following
select a,b or c,d from table where source=2 or target=2;
I want to select a,b if the source=2 or c,d if the target=2.
Is this possible ...
0
votes
0answers
19 views
Running multiple queries in Amazon RedShift
I am having problem in running multiple queries on Amazon RedShift.
RedShift is using PostgreSql ver. 8.0.2.
It is written in their document that for executing multiple statements, use 'BEGIN' ...