Can't execute a simple psycopg2 script twice when running from ArcGIS Desktop...
I’m building a geoprocessing service that queries an SDE database (running on postgres) and returns results. I do a lot of development by calling the script from a toolbox in ArcGIS desktop 10.3. For...
View ArticleWhat parts make up pg_database_size?
I’m trying to write a munin plugin to graph DB sizes. Alongside using pg_database_size I want to graph the components thereof as well. So far, I’ve come up with the following: SELECT...
View ArticleWhy does time zone have such a crazy offset-from-UTC on year 0001 in Postgres?
In Postgres 9.5, I was surprised to see the result seen below while experimenting with year 0001 (no year zero 0000). Offset of -07:52:58? Some example code. Note that I mixed use of TIMESTAMP WITH...
View ArticleHow to return a single column value using a PostgreSQL function? [closed]
I want to return a single column value in PostgreSQL function from a PostgreSQL database. How can I achieve that?
View ArticleFind current owner of custom data type?
In Postgresql, when I try to run ALTER TYPE x ADD VALUE y; on a custom datatype I get an error stating PG::Error: ERROR: must be owner of type x. I know this can be solved by running ALTER TYPE x OWNER...
View ArticleHow to set roles and users with correct permissions on Postgres? [closed]
My current database uat has as owner postgres. But now I would like to set roles and users with the correct permissions. Something simple like: roles: dba, developer, application users: dba1, dev1,...
View ArticlepgAgent not working on linux (Ubuntu 14.04)
I am running Postgres 9.3 on Ubuntu 14.04 and I am unable to get pgAgent daemon/service to run. I have confirmed that the daemon is not running using service --status-all. When trying to run pgagent...
View ArticleCreate a trigger in Postgres that will insert a record to another table with...
I have these 2 tables created in postgres, CREATE TABLE EMPLOYEE( ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(100) NOT NULL, ADDRESS VARCHAR (250) NOT NULL ); CREATE TABLE HIST_EMPLOYEE( HISTORYNUM INT...
View ArticleI Need Help Setting Up Roles and Passwords in PostgreSQL
I’m using the postgres.app on my Mac Mini Server running version 9.4.0 using El Capitan. I have not done any customization in pg-hba.conf. I do not have a .pgpass file. I believe that .pgpass is used...
View ArticleSlony with Amazon's RDS service?
Is it actually possible to somehow use Slony with Amazon’s RDS service? I’m aware that there’s no such thing as a host that you can log into to make Slony’s configurations, but perhaps it can be done...
View ArticleWhat PostgreSQL version to use with QGIS 2.8 (on Linux/Fedora 21)
I’m looking to install QGIS on my Linux/Fedora 21 laptop. QGIS ver. 2.8 seems to be the new/stable version (Feb. 2016) What PostgreSQL version should I use with that?
View Articlelibiconv-2.dll missing when running shp2pgsql
My system is Windows 7 with PostgreSQL 9.4 and PostGIS 2.2. I’m running shp2pgsql program from command line (cmd window, not PSQL interface). shp2pgsql "D:file.shp" schema.table > file.sql I’m...
View ArticleHelp using ST_Buffer for points
So I am trying to do a where clause on a select and my code is ST_Within(shape::GEOMETRY, ST_Buffer(ST_GeogFromText('@Value(_location)'), 5, 'endcap=round join=round') I am trying to buffer the...
View ArticlePostgreSQL, how to query the database to retrieve the percentile elements of...
I need a PostgreSQL query that do the following job: given a percentage (e.g. 10%), the query should return each 1st element of each percentile, among all the elements selected. So suppose in this...
View ArticleSELECT + INSERT or INSERT alone
I have an application where several devices send data every second to my server. On the database I have a table with the devices and another table with the data sent every second. The first time a...
View ArticleHelp with adding a time filter to Postgres query
I’ve asked this question over in SE GIS, but told it would be better suited to this SE, so here goes… I know Postgres is brilliant for grouping points based on their spatial values – that I can do –...
View ArticleGrouping and Transposing Rows to Columns in PostgreSQL
I have the follwing situation: I have profiles and tasks. One profile can be used once for each task. I track usage in profiles_used table. I need to build a report that shows how many profiles of each...
View ArticleUse Postgis to convert wkb_geometry data type to geom datatype
How would I write an ALTER statement or otherwise to convert an existing imported data column from ” wkb_geometry geometry(LineString,4326)” to a geom data type? I ask because I’ve moved to importing...
View ArticlePGPool for Postgres load balancing, where to sit it
So I’ve been doing a stack of reading. I’m still not 100% clear of the best way to go about it. Let’s take a simple setup. 3 nodes to server UWSGI apps (in random), 3 nodes for PGSQL, 1 nominal master...
View Articlein postgres how to select items that have a dupe across two columns
My data looks like this: queryable_type queryable_id User 1 User 2 User 2 I’d like to return dupes so that my result would look like this: queryable_type queryable_id count User 2 2 I’m assuming some...
View Article