178,988 questions
-2
votes
0
answers
22
views
postgres exited with code 1 "nc: bad address 'postgres'" temporal docker-compose [closed]
I'm trying to run the temporal server locally with Docker, but I'm having this PostgreSQL issue.
I initially realised that there was an issue with the formatting and indexing of my Docker file, and I ...
Advice
0
votes
3
replies
53
views
PostgreSQL, unique on combination of two columns
In PostgreSQL, it is easy to set a uniqueness constraint for two columns using CONSTRAINT UNIQUE.
For example
CREATE TABLE someTable (
id serial PRIMARY KEY,
col1 int NOT NULL,
col2 int ...
0
votes
0
answers
31
views
Rails 8 test trying to find unknown relation
I've been trying to write model tests for my Ruby on Rails 8 + Postgres project, but even with the simplest tests I get the following error.
I've never had a table or a relationship called listing, ...
0
votes
1
answer
36
views
How to connect to a Postgres accessible under a pathname via JDBC?
I have a Postgres on a server which is available under https://somethig.my.domain/postgres on port 5432. I'm trying to connect to it via DataGrip (which uses JDBC driver underneath), but cannot figure ...
1
vote
2
answers
67
views
Trigger on PostgreSQL updating salary column
I am having some troubles setting a trigger in PostgreSQL. I have a table Employees with columns such as employee_id, salary and hourly_pay. The salary is annual, so I'd like to change the salary when ...
0
votes
0
answers
37
views
MacOS : Postgres dumping result with permission denied, butg sometime passed [closed]
i'm trying to dump data with script file .sh
So i got a folder in /Home with : working , and inside would be dev-sever and dev-docker
When i run docker there is no error but when i open terminal and ...
-1
votes
0
answers
30
views
How to upgrade cluster from Postgres 17 Windows to Postgres 18 Debian [migrated]
Postgres 17 cluster is in Windows server in Estonian locale. Databases are defined like
CREATE DATABASE mydb
WITH
OWNER = mydb_owner
ENCODING = 'UTF8'
LC_COLLATE = 'et-EE'
LC_CTYPE ...
Advice
1
vote
2
replies
44
views
ordering whole query by the field of multiset in jooq
in spring boot, i wanna have nested records, because if that i need to use multiset in my selects. then i need to order the whole query by fields in my multiset. but the problem is that i get a error ...
0
votes
0
answers
122
views
How to use index in simple select
Table has index on name column:
CREATE TABLE firma2.klient
(
kood character(12) primary key,
nimi character(100),
...
);
CREATE INDEX IF NOT EXISTS ...
1
vote
2
answers
114
views
How to call Postgres function from .NET? [closed]
I tried this code:
CREATE OR REPLACE FUNCTION public.t4(in iid int, OUT n1 text, OUT n2 text)
LANGUAGE plpgsql
AS $function$
BEGIN
SELECT DISTINCT n1=l.name, n2=l.comment from ...
Tooling
0
votes
1
replies
30
views
How to write test code for Prisma version 7
For testing Prisma, I used prismock or prisma-mock . But those packages are compatible with Prisma version 6 or earlier. I visit the Prisma Official website, and they are suggesting using jest-mock-...
0
votes
0
answers
36
views
Connection to remote PostgreSQL server with hashtag in password with node-postgres
I have a password for a remote PostgreSQL server that I cannot change. This password contains hashtags (#). From searching, I know that this can be a problem.
I can connect to the server from the ...
Advice
1
vote
5
replies
53
views
Determine Connectedness Components for a Graph with a RECURSIVE Cte
I have a graph given by 2-element sets of points, say in a table
CREATE TABLE edge_set (
INTEGER edge_set_id,
INTEGER point_id
)
I want to determine the graphs connectedness components. These ...
0
votes
1
answer
54
views
What is the practical difference between static and dynamic background workers in PostgreSQL?
I’m trying to understand when to use a static background worker vs a dynamic one in PostgreSQL.
From what I know so far:
Static workers are registered during postmaster startup
Dynamic workers can be ...
Advice
0
votes
3
replies
63
views
PostgreSQL: primary key based on timestamp
I am working on a highload system, which needs to process quite a lot of events, but not an insanely huge amount. The data ingested has to be editable during a short period of time, and then the need ...
2
votes
3
answers
120
views
Find maximal subsets
I have sets identified by a set_id, say:
CREATE TABLE sets (
INTEGER set_id,
INTEGER element_id
);
I need a SELECT statement that finds the sets that are maximal with respect to the subset ...
Best practices
0
votes
1
replies
39
views
How to run Production PostgreSQL on a VPS (Hetzner/Digital Ocean,etc) - best practices etc?
I am getting into the world of self-hosted applications and I am trying to run a Production PostgreSQL on a VPS - Hetzner.
So far I have been using AWS RDS and everything has been working great - ...
0
votes
0
answers
25
views
cloudsql gcp PGAUDIT
I activated pgaudit on my Cloud SQL instance by adding the two flags enable and pgaudit.log, and I immediately saw audit logs in Cloud Logging without having to create the extension. When I connect to ...
-3
votes
0
answers
39
views
Supabase realtime postgres changes with RLS policy [closed]
Im having an issue with supabase postgres changes. I have a subscription on frontend to watch for changes on a table using RLS policy to only see the changes of the current user.
The problem that im ...
-2
votes
0
answers
33
views
PostgreSQL installation error: "The database cluster initialization failed" [closed]
enter image description here
I’m trying to install PostgreSQL on Windows, but the installation fails during the post-installation step. During setup, I get this error message:
A problem occurred ...
Advice
0
votes
0
replies
49
views
How apply airflow db migration and save them into postgress docker image?
I use docker-compose to run airflow. Postgres section is
postgres:
image: postgres:12.16
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
healthcheck:
test: [ "...
0
votes
1
answer
52
views
insert sample data into a postgresql in docker container not working [closed]
I am running a postgresql in docker container and trying to insert some sample data into this database.
prepare_source_data.sql exists in the host environment.
here I tried
docker exec -it postgres ...
-3
votes
0
answers
48
views
How to implement data forward fill in TimescaleDB?
TimescaleDB version:2.21.3
PostgreSQL version: 17.6
I created a hypertable using the following SQL statement.
CREATE TABLE device_telemetry_test (
ts TIMESTAMPTZ NOT NULL,
...
0
votes
1
answer
59
views
SQLAlchemy and partitioning table [closed]
I have tables which are already in Postgres and partitioned. How can I write a query with partioned birth_year
stmt = select(UserOrm)
session.execute(stmt)`
1
vote
2
answers
102
views
CREATE OR REPLACE FUNCTION in concurrently running transactions
How does create or replace function in PostgreSQL 14 behave with respect to transactions? If there are multiple concurrent transactions running at read committed isolation level, and trying to create ...
0
votes
0
answers
65
views
Flyway migration unable to create relation (table) when attempting to add table to Java API [closed]
I am working on a Java Spring API where I need to create new relations (tables) that will be stored in a PostgreSQL database.
I am creating new tables that add a new column to the existing tables with ...
-3
votes
0
answers
92
views
Error in PostgreSQL when running Rails and PostgreSQL using Docker Compose
When I run the command on docker container backend:
psql -h localhost -p 5432 -U postgres
I receive the following error:
psql: error: connection to server at "localhost" (::1), port 5432 ...
1
vote
2
answers
110
views
Frequent update of records in database
I’m building a real-time chat application using NestJS, Postgresql (Main DB), Redis and Socket.IO.
My database schema (simplified) looks like this:
-- Chats
table chats (
id serial primary key,
...
1
vote
0
answers
110
views
Large joins between three tables in Postgres and potential improvement
Below is my postgres db settings:
VERSION: PostgreSQL 15.14 on x86_64-pc-linux-gnu, compiled by Debian clang version 12.0.1, 64-bit'.
SHOW work_mem: 4MB
Now suppose I have three tables below in ...
0
votes
0
answers
32
views
Supabase upsert in React Native profile table not updating onboarding_completed
I'm building a mobile app with React Native (Expo) and using Supabase for authentication and user profiles.
This is my profiles table
create table public.profiles (
id uuid primary key references ...
1
vote
1
answer
996
views
Stuck with Prisma error after updating to v7
I was working with Prisma and NestJS and it is fine but when I updated Prisma to version 7 I started getting errors, fixed them, but I am stuck with this one.
Part of schema:
datasource db {
...
0
votes
1
answer
40
views
Supabase RLS: Anonymous INSERT into reviews returns 401 while authenticated INSERT works (campaign_id active, policies correct)
I’m facing a strange Supabase RLS issue that I can’t resolve after days of debugging.
I have a public review flow:
Users should be able to submit reviews without logging in (anonymous users) and also ...
Advice
1
vote
1
replies
50
views
How do I make an authenticated request from my Next.js API on Supabase with RLS enabled?
In my case, I only want authenticated users to perform a SELECT query on my database, so I set up my RLS Policy for this scenario. This is where I am hitting an issue. With RLS enabled, I need to let ...
0
votes
0
answers
117
views
PostgreSQL function "is not unique" [closed]
I am using PostgreSQL 18.0 and I have written a function with default parameters which inserts movie into the table. However, when I add the argument which must be added, it gives error:
SQL Error [...
0
votes
1
answer
48
views
Can I remove the pg_try_advisory_lock() call for function run_maintenance_proc() generated by pg_partman extension?
Why does the PostgreSQL run_maintenance_proc need pg_try_advisory_lock? Can I remove that? It keeps creating table deadlocks.
Its probably because I am also using dbt to generate a few materialized ...
1
vote
1
answer
114
views
Unallowed GRANT does not raise an exception and doesn't grant the privilege either, if user already has other privileges on the object
I have a regression test for a PostgreSQL database that checks to make sure a particular user cannot self-assign additional privileges to a particular schema. I do this by logging in as the user "...
0
votes
0
answers
62
views
Cannot connect to PostgreSQL over Cloudflare Tunnel
I’m running into a problem exposing a PostgreSQL database through a Cloudflare Tunnel, and I’m hoping someone with deeper Cloudflare Zero Trust/WARP experience can help me understand what’s going on.
...
1
vote
0
answers
68
views
Inserting into text array column when using unnest() [duplicate]
I have a table with the follow definition:
CREATE TABLE "test" (
id UUID PRIMARY KEY,
created TIMESTAMPTZ NOT NULL,
description TEXT,
permissions TEXT[]
);
I want to bulk ...
0
votes
1
answer
52
views
Spring native query (declare..begin..end) with parameters
I have trouble passing parameters for a native query with declare..begin..end style.
This code doesn't work:
@Test
@Transactional
void foo() {
em.createNativeQuery("""
do
...
0
votes
1
answer
55
views
Why does `.WithInitScripts` not run my SQL files? [closed]
Description
I am using a test Postgres container (from testcontainers) for more accurate integration tests. To prevent repeating code, I want to use my existing SQL migration files to setup the ...
2
votes
1
answer
66
views
Storing store time of day ranges where timezone matters
I need to store some store hours that exist in different time zones and may be interacted with in different timezones through an admin portal where it will display store time and local time.
I know ...
3
votes
1
answer
115
views
Self-signed certificate error when forcing SSL connecting to RDS PSQL [closed]
Hoping to get yalls help on the issue I am now sort of desperate about
Context:
I am deploying a docker container on EC2 Ubuntu, where it is used by two images - one for my Prisma-NestJs-based API and ...
1
vote
1
answer
64
views
PostgreSQL SQLAlchemy index NULLS NOT DISTINCT [duplicate]
I have a table (TA) on which I want to have a composite unique index on two columns (col1 and col2).
col2 can be NULL.
I know Postgres treats NULLs as distinct.
In SQL I would therefore do:
CREATE ...
-1
votes
1
answer
73
views
Adding CHECK Constraint Without Error and Duplication [duplicate]
I have implemented this code to add a check constraint after creating the table
ALTER TABLE recruitment_data.candidate_experiences
ADD CONSTRAINT chk_experience_dates
CHECK ( ...
2
votes
1
answer
47
views
Jooq get sequence increment
Maybe there's an easier way to get the Increment with JOOQ?
This one looks more like a crutch:
int increment =
Optional.ofNullable(CUSTOMER_ID_SEQ.getIncrementBy())
.map(Field::getName)
...
2
votes
1
answer
59
views
Symfony/Doctrine: PostgreSQL Migration Issue – Undefined column error only in HTTP Kernel (CLI works)
Symfony/Doctrine: PostgreSQL Migration Issue – Undefined column error only in HTTP Kernel (CLI works)
I'm working on a Symfony 7.3 project running on PHP 8.2. I recently migrated the database from ...
2
votes
1
answer
94
views
Using pg_try_advisory_xact_lock for events processing with strict ordering
Suppose I am implementing a local Event-Driven service with internal events to decouple logic.
For database we use Postgres 17 and PgBouncer with transactional mode. It's just a single instance.
...
0
votes
0
answers
99
views
Failing healthcheck of GitLab CI PostgreSQL service
I get this error in my pipelines:
Health check container logs:
2025-11-18T09:45:19.064500182Z FATAL: No HOST or PORT found
Service container logs:
2025-11-18T09:45:19.061855973Z ...
1
vote
1
answer
88
views
Creating Materialized view in PG 17 ignores data types in SELECT
I have the following SQL to create a materialized view and the SQL seems reasonable to me but it's unclear from Postgres docs what should happen in this case.
I am listing the columns when creating ...
1
vote
1
answer
120
views
Postgres Recursive Query Behavior
I have a table test with two columns, each referencing the other
ID1
ID2
2
1
3
2
4
3
5
4
Given an id, I need to traverse the chain to return all the rows traversing the chain. Below is the query I ...