Compare data between 2 different schemas
We refactored our old database. Some tables were dropped, some tables were split into 2 new tables etc. So now we have an absolutely new DB schema which has many differences from the old one. Someone...
View Articlepostgresql: accept subdomain wildcards?
I want to accept all db connections from servers with domain mydomain.com so that all subdomains like tiger.mydomain.com, venus.mydomain.com will have access to the postgresql server. I’ve read that...
View ArticlePostgres drop type XX000 “cache lookup failed for type”
I’m currently working on a PostgreSQL 9.2.x Database with a lots of Clients, and tables and functions. We deploy code constantly and sometimes it is necessary to even drop a type or a function due this...
View ArticleGetting wrong results from fulltext search in PostgreSQL
This is the query which I am running. The keyword “exhausted” is present only in one of the rows but I am getting all 3 rows. How to avoid the rows where the keyword is not present? DDL: CREATE TABLE...
View Articlecreate insertion rule on view returning id
I have a table private.products and a view public.products representing that table. And I want to create entries in private.products while inserting into view, it all works right, except that I also...
View ArticleCan I use `on delete set null` on a compound foreign key which contains a...
The docs say: Restricting and cascading deletes are the two most common options. RESTRICT prevents deletion of a referenced row. NO ACTION means that if any referencing rows still exist when the...
View ArticleDatabase Change Management
What are ways in which teams handle database change management? I have a team of 8 developers making database changes concurrently. Each developer is responsible for updating their changes in what we...
View ArticleHow to create a citation/quote from a Postgres text field?
I have a database with a lot of text and I want to find the surrounding text for a word that I am searching for i.e. If I search this text for “text” I should get something like (and more consistent...
View ArticleInitialize, Start Server and Create Database in Single Script
I am writing a provision script for a dev environment with the following: sudo su - postgres <<EOF cd ~/data pg_ctl -D . initdb pg_ctl -D . -l run.log start createdb mydb pg_ctl -D . stop EOF It...
View ArticleIndex Advisor in postgres advisor [on hold]
I use Postgres as my Database.As part of my project I am trying to Index adviser for Postgres which suggests indexes automatically to the queries running slow . As far as I know only “EDB” has done...
View ArticleERROR: relation “name” does not exist
I am trying to import a postgresql database table sent to me in phpPgAdmin, I am following the instruction from this import database But after doing so, several error appear, I also tried to import the...
View ArticleHow can I add a numeric version_id column to an existing table?
I have a table in a postgres db with rows versioned with a timestamp that I’d like to add a numeric version_id column to. eg. existing: ID VERSION_DATE -- ----------------------- A 2015-02-05...
View ArticlePostgres shared_buffers utilization
Hi is it possible to show how much of the shared_buffers postgres is using or how can i know it is too small?
View ArticlePostgreSQL: Use column with hash based on other columns as unique index?
My previous problem is still not fixed: We cannot set a unique index because NULL values are allowed… we use this table in our database: CREATE TABLE offer ( offer_id serial PRIMARY KEY , product_id...
View Article“No Loop” Constraint for hierarchical data in postgresql
I’ve got table like this in postgres: id primary key parent_id foreign key on id some data columns I need no a constrain which prevents cycles on the parent relations. There might be more tree in the...
View ArticleI cant connect to PosgreSQl throgh PG Admin
While i try to connect throgh PGAdmin this error message displayed ” Error connecting to the server: FATAL: Peer authentication failed for user “postgres” “
View ArticlePostgresql service run failure
Trying to setup replication through the wal shipping using Postgresql 9.3 x64. Used this instruction from youtube. The problem is – the slave postgresql service won’t run. This is what in logs IST...
View ArticlePostgreSQL/PostGIS Geom to JSON with Inner Join to another table
I am currently producing JSON from a database successfully using the following query: SELECT row_to_json(fc) FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM...
View ArticleHAVING ANY in Postgres
I’m looking for the right syntax to filter groups (i.e. groups of rows that have been GROUP BY‘d) where at least one row fits a certain condition. For example if I wanted to select a group where at...
View ArticleSlow transactions, many locks
At high load conditions the server app stops responding to client because begin/commit statements are executing very slowly (some take 15 seconds). The queries are simple – insert, update two columns...
View Article