Category "postgresql"

PostgreSQL ORDER BY with VIEWs

Let's say I want to write a simple SELECT query that uses a VIEW: CREATE TEMP VIEW people AS SELECT p.person_id ,p.full_name ,p.phone FROM person

How to define a default value for a column after a cast in a pgloader script?

Let's say I'm migrating a MySQL database to PostgreSQL with pgloader, using the default sample on the official website: load database from mysql://

How to remove reverse duplicates from a SQL query

Context: I have a select query where I have have link between devices. Some links have "reverse duplicates" that I would like to get rid of in the select query

django test app error - Got an error creating the test database: permission denied to create database

When I try to test any app with command (I noticed it when I tried to deploy myproject using fabric, which uses this command): python manage.py test appname

JPA ERROR: relation does not exist

I can't figure out what I'm doing wrong. I'm learning JPA mapping to a relational DB, by following some tutorials on the web, but can't find one that is straigh

Can't set Password for Postgres using docker-compose

I am not able to set Password for Postgres using Docker-compose. Postgres is loading without password and with the default user name "postgres", non of the envi

GroupingError: ERROR: column " " must appear in the GROUP BY clause or be used in an aggregate function

I am trying to create a list of unique patients who have left comments. The code words fine until I upload to heroku where it doesnt work in postgresql. This

How to Force Postgresql User Login with Password

All I did is in my local machine(Mac OS). After installing the postgresql, I created a user named poet with password, then created a database named poems and th

Docker Compose + Spring Boot + Postgres connection

I have a Java Spring Boot app which works with a Postgres database. I want to use Docker for both of them. I initially put just the Postgres in Docker, and I ha

Postgresql: How to repeat query as soon as finished?

Let's say I have a query like so: SELECT * FROM a WHERE a.Category = 'liquid' ORDER BY a.MeasurementTime DESC; and I want to see the results coming into the da

Detect SQL island over multiple parameters and conditions

(PostgreSQL 8.4) I got a great introduction to SQL gaps-and-islands here on Stack Overflow but I still have a question. Many island detection CTEs are based on

Django 4 connection to Postgresql using passfile: "fe_sendauth: no password supplied"

Hello SO & Django community, My problem is related to Django 4, as the feature to use passfile to connect to Postgres has appeared in this version. Though I

How to limit the memory that is available for PostgreSQL server?

For an academic experiment I need to restrict the total amount of memory that is available for a pgSQL server to compute a given set of queries. I know that I c

Permission denied in postgres

I missed a bit with chmod and permissions. And now got a lot of problems with access to folders. If I start server I see in browser: could not connect to ser

PL/pgSQL checking if a row exists

I'm writing a function in PL/pgSQL, and I'm looking for the simplest way to check if a row exists. Right now I'm SELECTing an integer into a boolean, which does

How to get Returning value in Gorm Postgress

I have created an serial_num (auto incremented/ serial type ) column in our postgress db. my contact struct type is as of below and i am using upsert operation

Postgres equivalent for Oracle's DBA_FREE_SPACE and DBA_DATA_FILES

This is the sql query. I need to convert into postgres query SELECT a.tablespace_name, a.maxbytes, a.mbytes, (a.maxbytes - a.mbytes),

PL/pgSQL SELECT into an array

Here's my function declaration and part of the body: CREATE OR REPLACE FUNCTION access_update() RETURNS void AS $$ DECLARE team_ids bigint[]; BEGIN SELECT

PostgreSQL could not receive data from server: Software caused connection abort (0x00002745/10053)

I tried to establish a connection in pgAdmin to the PostgresSQL server. I always get the message: could not receive data from server: Software caused connectio

Combined SELECT from unnested composite type array and regular column

I have a table my_friends_cards: id | name | rare_cards_composite[] | ---+---------+------------------------ 1 | 'timmy' | { {1923, 'baberuth'}, {1999, 'j