Quantcast
Channel: Question and Answer » postgresql
Browsing all 1138 articles
Browse latest View live

postgresql insert from select query, plus static values

Referring to How to insert values into a table from a select query in PostgreSQL?, I would like to INSERT into a table rows from another, specified by a SELECT DISTINCT, plus some static values,...

View Article


Should I do the maths within PostgreSQL for ACIDity?

It is my first question on Database Administration Stack Exchange. Please be kind if something is not done the nice way.. I would like to be advised concerning the way I’m working on my database, in...

View Article


PostgreSQL: Calculate balance working backwards from current balance

I have a balances table that stores the current_balance for bank accounts; and a transfers table that contains a row for every transfer to- and from an account (deposits are positive numbers,...

View Article

INSERT INTO using the RETURNING values from another INSERT

I’d like to do something like this: INSERT INTO table2(name) INSERT INTO table1(name, address) VALUES ('me', 'home') RETURNING name; And then I would expect a new record in table2 with 'me' in name....

View Article

Pooling at the app layer or in an intermediate layer?

I need to use a connection pool with PostgreSQL. I do not need load balancing or replication, just pooling. What would be the best option? Pooling at the app layer (using a JDBC connection pool) or in...

View Article


Constraint Information – PostgreSQL 9.2

I was trying to delete some data from the table dm.billables: 1 – Select the id – PASS SELECT * INTO junk.clientid_10306 FROM dm.billables WHERE account_id = 10306; 2 – Delete the data from the table...

View Article

SELECT very slow when no results and a LIMIT is specified

I am running into an issue where a SELECT query is very slow because it does not use an index when the number of final results is 0 and a LIMIT clause is specified. If the number of results is greater...

View Article

Accessing a row directly at a table in PostgreSQL by using the PostgreSQL's...

I am writing a PostgreSQL extension using the C language. I would like to do the following tasks: Store a set of rowids (or other row identifier, like ctid). Each rowid uniquely represents a row in its...

View Article


Update one table from another based on spatial join

In beginning i had two tables of points and i wanted create from one of this POINT table new table CIRCLES which will contain circle polygons 300 metres around points. This step i have done here:...

View Article


Image may be NSFW.
Clik here to view.

How to calculate width and lengths of street layer in Postgis/PostgreSQL?

I was able to project the point location (ad.shp) to the nearest street (line.shp) like this. My approach was like this. I used ST_ClosestPoint() to iterate this for every point location within a...

View Article

Paged query against timestamp populated by trigger missing items

We’re having a strange problem with a PostgreSQL 9.2 database that I’ve been racking my brain trying to figure out. First some background. We have a “tombstone” table that is populated using a trigger...

View Article

psql: FATAL: password authentication failed for user “GuardDog_02”

In postgresql 9.5.1, I created a user called GuardDog_02. I gave it a password. And I gave it permissions to create db and user: CREATE USER GuardDog_02 WITH PASSWORD 'apple100' CREATEDB CREATEUSER;...

View Article

Adding and populating column in Postgres with data from existing column

I have a TEXT column in one of my existing database tables that holds both domain names and IP addresses. I’d like to add a new column to the existing table that’s of type INET and populate it with the...

View Article


postgres wal sender replication timeout during pg_basebackup

Let me start with the caveat that I am still green with Postgres. I am working on a postgres 9.2 Active/Standby cluster on Debian wheezy for an application, based off of the ClusterLabs pgsql cluster...

View Article

Profiling postgres with gprof: no data/gprof folder and 'no time accumulated'

I’m attempting to profile Postgres with gprof. A gmon.out file successfully gets created in both the data directory and in the working directory where I launched the client (pgbench) process from....

View Article


Find chunk_id for given record in Postgres

Is there a way to find details of the TOAST pointer for given row and column in Postgres (8.3)? Especially the chunk_id?

View Article

Detect when a CREATE INDEX CONCURRENTLY is finished in PostgreSQL

If I create an index CONCURRENTLY in PostgreSQL, how can I see when it is finished? I am attempting to rebuild indexes to solve index bloat, and I need to keep the old index around for a while until...

View Article


Cannot log in with default user on Mac 10.10

I am running PostgreSQL on a Mac 10.10 PostgreSQL 9.3.5 on x86_64-apple-darwin12.5.0, compiled by Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn), 64-bit I am having trouble connecting...

View Article

Index columns with arithmetic operators

I commonly make this query on my database SELECT * FROM Example_tab WHERE Column_a + Column_b < 10;. Is it possible to create indexes based on Column_a + Column_b < 10 to speed up this lookup. I...

View Article

Applying values to highest terminal segments in channel network using...

I extracted a channel network from a dem but due to some technical difficulties the layer had some discontinuities. So after filling them, i suddenly realised that the Strahler orders it gave me were...

View Article
Browsing all 1138 articles
Browse latest View live