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

Streaming replication Postgresql 9.3 using two different servers

Settings in master server: max_wal_senders = 1 wal_level = 'archive' archive_mode = on archive_command = 'cd .' wal_keep_segments = 10000 Settings in slave server: in recovery.conf file: Standby_mode =...

View Article


Postgresql: set default psql client encoding

When I connect to a Postgresql DB using psql, I often get these messages: => SELECT * FROM question_view ; ERROR: character with byte sequence 0xd7 0x9e in encoding "UTF8" has no equivalent in...

View Article


Mixed search in multiple columns

I have a table which has a particular column of type JSON, where some user’s contact information are stored. I can alter the table and add new columns with cached values to increase search performance...

View Article

PostgreSQL – If I run multiple queries concurrently, under what circumstances...

I approach you all humbly as one who is NOT a DBA, and I’m sure that my question is fraught with conceptual shortcomings and “it depends on” land mines. I’m also pretty sure that all of you who choose...

View Article

Binary insert into Postgis geography column results in value being inserted...

When writing WKB as a value (and as a binary parameter) to a geography column, the persisted value is not geography. Example Java is also available here:...

View Article


Image may be NSFW.
Clik here to view.

How to change schema so that account_id reference is unique among 3 tables

Original image: Updated to have more-correct terminology and an ‘is_debit’ column: I am designing a (PostgreSQL) schema for a lottery website that uses double-entry accounting. ‘jackpots’, ‘users’, and...

View Article

PostgreSQL 9.3: Primary key violated by a trigger INSERT

My problem Consider a table t with many frequent updates from users, from which only the last few are relevant. In order to keep the table size reasonable, whenever a new row is inserted old rows from...

View Article

Add minutes contained in a column to a date

In CartoDB I want to add minutes contained in a column of data type number to a date. e.g. SELECT my_initial_date + ‘xx minute’::INTERVAL as my_date FROM table What is working is: SELECT...

View Article


osm2pgsql missing coordinates

I am quite new to GIS and OSM and am trying to get my head around exporting custom OSM region and uploading them into PostgreSQL. I have started with a very small map area to export with only two...

View Article


PostgreSQL replication with fsync disabled?

I need to run PostgreSQL in-memory (for performance reasons), so I intend to disable fsync, which means that no writes will be sent to the WAL. However, as part of my scheme to meet another requirement...

View Article

Adding standard set of constraints (rules) to PostGIS `raster` type column

Following on from my related prior question, let me elaborate this topic a bit. raster2pgsql is a raster loader executable that loads GDAL supported raster formats in PostGIS. It has a -C flag defined...

View Article

Need some help with this query or some ideas for change it to better model

I’ve a dilemma in my application and I don’t get how to solve it at DB level. The idea is that a user can be subscribed to one or more services but services are show depending on user type. This can...

View Article

File database vs application server database for concurrent performance &...

I asked a question about Ripple’s database implementation, and received this response: The ripple server uses SQLite for structured data and a configurable “back end” for unstructured “bulk” storage....

View Article


Creating a unique constraint on a PostGIS 'raster' type column

I am using the following command to add constraints to one of the raster image in PostGIS-2.1.3 (PostgreSQL-9.1.14). ALTER TABLE schema1.table1 ADD CONSTRAINT enforce_scalex_rast unique (rast); But...

View Article

How do I ORDER BY typical software release versions like X.Y.Z?

Given a “SoftwareReleases” table: | id | version | | 1 | 0.9 | | 2 | 1.0 | | 3 | 0.9.1 | | 4 | 1.1 | | 5 | 0.9.9 | | 6 | 0.9.10 | How do I produce this output? | id | version | | 1 | 0.9 | | 3 | 0.9.1...

View Article


Split two rows into two columns

I have the following table: id | name | action | count ------------------------------ 1 | Value1 | 0 | 27 1 | Value1 | 1 | 49 2 | Value2 | 0 | 7 2 | Value2 | 1 | 129 3 | Value3 | 0 | 9 3 | Value3 | 1 |...

View Article

Index for finding an element in a JSON Array in PostgreSQL (with multiple...

Original question of what this is based on: http://stackoverflow.com/questions/18404055/index-for-finding-an-element-in-a-json-array This works fine if you only want simple matches. Suppose tracks have...

View Article


PostgreSQL synchronous replication time out?

I’m using PostgreSQL 9.3 with synchronous replication. I have 2 synchronous replicators and 1 async replicator. My problem is when 2 synchronous replicators are down, transaction will wait...

View Article

Grant usage partially on schema to user on Postgres

I granted INSERT in a specific table for one user. The problem is that I need to also grant USAGE in the schema for this same user, but granting USAGE in schema also turn all relations in that schema...

View Article

How to make PostgreSQL default_tablespace work properly?

My question is, “Why isn’t database ‘screwy’ created in tablespace ‘screwy’? I made the following script, with it’s output following, to show the problem I am having : #!/bin/bash # export...

View Article
Browsing all 1138 articles
Browse latest View live