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

Recovery from Live to a new Slave Server – PostgreSQL – ERROR

I’ve started a new SLAVE PostgreSQL server set up. master: 192.168.100.1 slave1: 192.168.100.2 slave2(NEW SLAVE) 192.168.100.3 * NOTE: I run the pg_basebackup from another STANDBY SERVER. Not from the...

View Article


Image may be NSFW.
Clik here to view.

Postgres Can't Add Foreign Key Constraint

I have a table with about 220 million records and I need to add a foreign key constraint. My command looks something like this: ALTER TABLE events ADD CONSTRAINT events_visitor_id_fkey FOREIGN KEY...

View Article


Image may be NSFW.
Clik here to view.

after truncating a table in postgres, why does qgis lose track of...

I’m running a python script which drip-feeds data slowly into a postgres database with postgis extension. I’m using autocommit, and committing one row at a time. Horrendously slow, but I need to do it...

View Article

Image may be NSFW.
Clik here to view.

Get the 2 points immediately before and after a given point in PostGIS

In the picture below: The given point is C, I would like to select A and B, but not Z (which is closer to C than B but it’s not immediately after in the LineString). Note that C is always ON the line...

View Article

What role for plpythonu function's in the file system?

As a preliminary test for a further work I’m trying to use a simple plpythonu function in Postgresql 9.2 to create a folder in my filesystem. So I have this code : CREATE OR REPLACE FUNCTION...

View Article


Send Keyboard Interrupt in PostreSQL psql console?

Is it possible to send a keyboard interrupt signal to the PostgreSQL psql console that will take me back to a new console command line? Sometimes I’ll type a command incorrectly and then hit enter and...

View Article

Group and count array elements using intarray

I am working on a Postgres 9.4 project with the intarray extension enabled. We have a table that looks like this: items ------------------------------------- id name tag_ids...

View Article

Improving performance when importing file geodatabase into PostgreSQL?

I have a file geodatabase created with ArcMap 10.1 that contains one feature class with 650 million points. The feature class contains the shape field and an identifier. The .gdb is approximately 26GB....

View Article


What are the consequences of dropping or changing the user name for the...

I feel confident I understand what’s involved at the db level: If dropping, I’d need to create users for each sys admin, give them SUPERUSER, and then drop the postgres user. If changing the name, I’d...

View Article


PostgreSQL dump import only imprts tables and not data

I’m trying to import a postgreSQL dump into my DB. The dump is saved in a .sql file. I use the following command : psql -U postgres -d dhris < dbDump.sql and the table was created before. The import...

View Article

Which indexes should I create?

I need assistance in which indexes to create on a table, and the best approach for querying it. We use PostgreSQL. Here’s the table: create table myt ( the_time timestamp, oid int, counter int,...

View Article

Selecting latest row for user grouped by day help

Hoping someone can help me here as I can’t quite wrap my head around the best way to do this. Im trying to SUM() some numbers from a JSON block, which I have working just fine, how ever there could be...

View Article

Relationship based access control (ReBAC)

In my application, access control is based on relationships between entities. Consider this simplified schema: CREATE TABLE user (...); CREATE TABLE group (...); CREATE TABLE group_members( group_name...

View Article


How can update.php be disabled from checking for Postgres databases?

Whenever I try to run the database update script update.php after upgrading modules a WSOD appears and the php error log shows this message: PHP Fatal error: Class ‘DatabaseTasks_postgresql’ not found...

View Article

Foreign key for array column

I have a table: CREATE TABLE methods ( method_id serial PRIMARY KEY, method_name varchar(100) ); I want now to create a table with the following columns: CREATE TABLE experiments ( method integer[]...

View Article


PL/pgSQL issues when function used twice (caching problem ?)

I am facing an absolutely weird problem that feels much like a Postgres bug than an algorithm problem. I have this function: CREATE FUNCTION sp_connect(mail character varying, passwd character varying,...

View Article

Aggregate discarding values in one column that haven't a match in another column

Say, I have a table representing colored and labeled items inside numbered boxes. Each box can not contain more than one item with a particular label, but items with the same label (and the same or a...

View Article


DO INSTEAD in postresql Rules

I have a simple table like this : CREATE TABLE gateway_text ( id BIGSERIAL NOT NULL PRIMARY KEY, text TEXT NOT NULL, hash char(40) UNIQUE, created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL...

View Article

QGIS as Spatial Database RAD or Hierarchical Attribute Viewer/Editor?

I have designed a geological observational spatial database in PostgreSQL/PostGIS to manage geochemical samples, QAQC and geological map objects. Now is the not so fun/easy part of designing a front...

View Article

Fastest way to process OSM

I’ve been working with imposm and Python, it’s fairly easy to parallelise. I’ve hit a performance problem when trying to associate the coordinates to the ways. Creating a dictionary from coordinate_id...

View Article
Browsing all 1138 articles
Browse latest View live