Category "postgresql"

What's the PostgreSQL equivalent of $mysqli->connect_error?

If mysqli error is thrown while connecting to database, it could be detected as below. if ($mysqli->connect_error) { $this->Session->setFlash(__('

Insert null values to postgresql timestamp data type using python

I am tying to insert null value to a postgres timestamp datatype variable using python psycopg2. The problem is the other data types such as char or int takes

Can't run the server on Django (connection refused)

I finally (think) installed successfully PostgreSQL and also de psycopg2 (I use Windows). Btw, is some way to check it's working properly? Well, the thing now

PostgreSQL out of memory: Linux OOM killer

I am having issues with a large query, that I expect to rely on wrong configs of my postgresql.config. My setup is PostgreSQL 9.6 on Ubuntu 17.10 with 32GB RAM

WHERE col IN Query with empty array as parameter

From example where-col-in example and this answer, WHERE IN clauses should have query with parameters with following syntax const response = await db.any('SELE

How to avoid multiple function evals with the (func()).* syntax in a query?

Context When a function returns a TABLE or a SETOF composite-type, like this one: CREATE FUNCTION func(n int) returns table(i int, j bigint) as $$ BEGIN RETUR

Adding LIMIT to ARRAY_TO_JSON or ARRAY_AGG

In a 2-player game using PostgreSQL 9.6.6 as backend I have defined the following custom stored function for retrieving chat messages for a user: CREATE OR REP

What does GRANT USAGE ON SCHEMA do exactly?

I'm trying to create a Postgres database for the first time. I assigned basic read-only permissions to the DB role that must access the database from my PHP scr

PostgreSQL Exception: "An I/O error occured while sending to the backend"

I am testing some code which processes registration to a website. The java code is as follows (excerpt): if (request.getParameter("method").equals("checkEmail"

How I can access postgres log_connections logs

I see that log_connections enabled by default on Heroku PostgreSQL instance, but how I can get this log?

Setup Django Postgres database

I created the django app, I have it connected to my local server with pgAdmin3. I want to have the django app push to bitbucket. But the problem is: How do I s

Best way to maintain an ordered list in PostgreSQL?

Say I have a table called list, where there are items like these (the ids are random uuids): id rank text --- ----- ----- x 0 Hello x 1 World x

Deadlock involving SELECT FOR UPDATE

I have transaction with several queries. First, a select rows with FOR UPDATE lock: SELECT f.source_id FROM files AS f WHERE f.component_id = $1 AND f.a

postgresql sequence getting max_value

How to get max_value and min_value Postgres sequence? I created the sequence using this statement create sequence seqtest increment 1 minvalue 0 maxvalue 20;

Restoring database delta between two dumps

We're currently struggling with moving our Aurora Database to an RDS Postgres DB. Our database is quite huge with 80GB and some tables having up to 85 million e

Postgresql - SQL query to list all sequences in database

I would like to select all sequences in the database, get the schema of sequence, dependent table, the schema of a table, dependent column. I've tried the follo

Why does Postgres still do a Bitmap Heap Scan when a covering index is used?

The table looks something like this: CREATE TABLE "audit_log" ( "id" int4 NOT NULL DEFAULT nextval('audit_log_id_seq'::regclass), "entity" varchar(50) COLLA

How do I convert numpy NaN objects to SQL nulls?

I have a Pandas dataframe that I'm inserting into an SQL database. I'm using Psycopg2 directly to talk to the database, not SQLAlchemy, so I can't use Pandas b

How to dump a postgres db excluding one specific table?

I'd like to use pg_dump to backup postgres database content. I only want to ignore one specific table containing cached data of several hundred GB. How could I

postgresql installation mac: Set the LC_ALL environment variable to a valid local

I am trying to install postgresql 9.6 using brew on my mac and get the below error whenever i start the server : FATAL: postmaster became multithreaded during