How do I set the isolation level for SELECT statement?
Using PostgreSQL 9.5 I would like to make sure that when I run a SELECT statement I get consistent results, i.e. if the table is modified while the SELECT is running, I want to get the state that was...
View ArticleMix Public Transportation data with pgRouting
I’m looking to mix 3rd party data, such as public transportation (routes, schedule is optional), with geographic data imported from shapefile/osm. With this I plan to give users an option to select a...
View ArticleGiven a lat/long how to find the nearest node in a route calculated by...
I’m creating a table route_<route_id> for the route given by pgr_dijkstra, like this. In my application, I have a websocket with a mobile client that it’s sending it’s current position every x...
View Articlehow can i add tiled layer on Sharpmap using postgresql? [on hold]
map = new Map(); try { //VectorLayer v = new VectorLayer("Point", new PostGIS("server=localhost;port=5433;user=postgres;pwd=9839757437;database=OSM3", "GhanaRegions", "Geometry", "id")); VectorLayer v...
View Articleorg2ogr PostgreSQL to GPX
I already have found how to import GPX files into PostgreSQL using gdal/org2org. Now I am wondering of dumping into GPX files the results of my modification on dataset stored into PostgreSQL. But I...
View ArticleDeleting aged postgresql rows with foreignkey constraints
I have a postgresql table where I want to delete rows beyond a certain age. But the catch is that some foreign key constraints would be violated For instance, if I run DELETE FROM links_reply WHERE...
View ArticleCannot create database PostgreSQL [on hold]
Working with Ubuntu on a server. I installed PostgreSQL. Baiscally I am following this tutorial. I am logged in with my user accoung max. I logged into the PostgreSQL account from the bash prompt like...
View ArticleHow to select number of affected rows to variable in function?
create or replace function test() returns void as $$ begin update tbl set col1 = true where col2 = false; -- now I want to raise exception if update query affected more than 2 rows to rollback the...
View ArticleHow to configure sympa with plesk root access using mysql usename...
I’m trying to use MySql, but username is admin@localhost. It was root but plesk changes it to admin. I also tried PostgreSQL but after it asks for the root password there is another request to access...
View ArticleQuery bytea column using prefix
Assuming I have a table with a bytea column called data on a table called t, how can I: Write a query that returns all rows which have a specific prefix on their data column. Index the query. I am...
View ArticleArray of template type in PL/pgSQL function using %TYPE
I have a PostgreSQL database and a PL/pgSQL function that currently has arguments with copied types (for example IN arg_1 table_1.column_1%TYPE). I want to update it so one of those arguments is...
View ArticleWhere to put snowball files to add a snowball stemmer to PostgreSQL database?
I’ve downloaded Czech snowball stemmer source files (.c, .h files) and compiled them into .o files and I know the correct SQL syntax for adding the dictionary (it’s in the docs). I keep getting the...
View ArticlePostgresql uuid syntax error
I am trying to insert/update a foreign key field which is also a uuid to use the correct fk id for this set of data: zuri=# ALTER TABLE newarts ALTER COLUMN jurisdiction_id SET DEFAULT...
View ArticlePostgres copy from CSV: how to format range variables?
Consider a Postgres table containing a range variable: CREATE TABLE my_table (t_range tsrange, field1 text); If I want to manually insert a row via psql, I can run: INSERT INTO my_table (t_range,...
View ArticlePostgresql server is running, but service appears stopped
I am running Postgresql 9.4 as a service on Windows Server 2008 R2. It usually works as a charm, but now there is a situation when the server is apparently running (I can connect to it, Task Manager...
View ArticleSelecting parent and child data
I have an application front end which speaks to a PostgreSQL database. I’m trying to find the most efficient way to extract a structure similar to the below. CREATE TABLE people ( person_id SERIAL...
View ArticleIs there a way to automatically set triggers to update a field that is...
Let’s say that I have these tables: user, task, and submission. A user can create a submission which will be scored by the system, which will assign a value to submission.score. Now, everytime a...
View ArticleIn Postgres, how to preserve newline character in COPY TO command?
One of the column of my table contains string with ‘n’. postgres=# select * from stringtest ; id | inputstr ----+----------------- 1 | Name : NOCr + | r + | Detail : Detail (1 row) But when I retrieve...
View ArticleReplicating redis foreign table via postgresql synchronous replication
I have synchronous replication between db server, DB1 and DB2. Tested, working. I have a redis server (RD1), integrated with DB1 (master) via redis_fdw, no issues here. I was expecting foreign redis...
View ArticleAccessing a column from PostgreSQL database and plotting it on Google Maps...
I have a database created. This database has a column called Latitude/Longitude. I wanna access this Latitude/Longitude field and plot it on Google Maps. What could be the best way to do this? I was...
View Article