178,973 questions
0
votes
0
answers
50
views
Prisma db push command hangs when using Supabase transaction pooler ( port - 6543)
I'm building a full-stack application using Prisma for database.
When I run, npx prisma db push
that command stuck and does not complete
My DATABASE_URL is using the Supabase transaction poller ...
1
vote
1
answer
85
views
SQLAlchemy query to get keys from a JSON as an array, not separate rows
Suppose I have a SQLAlchemy model that looks like this:
class MyModel(meta.Base)
id = Column(BigInteger, autoincrement=True, primary_key=True)
extra_data = Column(postgresql.JSON, nullable=...
1
vote
0
answers
69
views
`pgoutput` does not send BEGIN/COMMIT for empty transactions in PostgreSQL 18 — replication slot LSN does not advance
Problem
After upgrading from PostgreSQL 17 to PostgreSQL 18, our logical replication consumer stops advancing restart_lsn on the replication slot when workload consists mainly of empty transactions (...
Best practices
0
votes
9
replies
72
views
RBAC: How to model per-user permission overrides?
I'm building a multi-tenant hotel booking app as a personal project. I’m trying to figure out a good way to handle permission overrides (mainly for hotel users)
My schema:
A) role_permissions defines ...
1
vote
2
answers
89
views
Django tests in GitLab CI always use PostgreSQL instead of SQLite despite APP_ENV override
I am running Django tests inside GitLab CI and trying to switch between SQLite (for local/test) and PostgreSQL (for production).
My settings structure looks like this:
settings/_init_.py:
import os
...
Best practices
0
votes
2
replies
54
views
How to write a (postgresql) SqlAlchemy filter that checks if a JSONB column has exactly this list of keys?
Suppose I have a SQLAlchemy model that looks like this:
class MyModel(meta.Base)
extra_data = Column(postgresql.JSON, nullable=False)
The following (I believe, but I have not run it) works. It ...
2
votes
1
answer
58
views
Google Cloud Datastream PostgreSQL DELETE events only include primary key columns
I am using Google Cloud Datastream with Cloud SQL for PostgreSQL as the source, and I am trying to understand what Datastream is expected to include in PostgreSQL DELETE events.
My source table is ...
Advice
0
votes
2
replies
57
views
i'm designing database for this homework
I have a homework that need designing database for a system and I'm wondering whether I'm doing it good or not, please give me some advices, thank you all!
via link:
Database
and relationship i think:
...
Advice
1
vote
5
replies
97
views
How do you correctly enforce only one active row per user with Doctrine and PostgreSQL under concurrent requests?
I ran into a design problem in a Symfony + Doctrine + PostgreSQL project and I want to make sure I am solving it at the correct layer.
I have an entity where one user can have many rows, but only one ...
-2
votes
1
answer
44
views
DNF/YUM shows PostgreSQL dependency with --assumeno. Will disabling it cause package conflicts? [closed]
I am trying to update packages using dnf (or yum). Before performing the update, I ran the command with --assumeno to preview the transaction:
sudo dnf update --assumeno
In the output, it shows that ...
1
vote
1
answer
62
views
I'm using the Postgres node js library to dynamically create a table. How do I properly handle the SQL fragments for column type names, i.e. boolean?
I'm trying to use the Postgres npm library to dynamically create tables like this:
const table = {
schema: 'public',
name: 'test',
columns: [
{name: 'id', type: 'uuid', pk: true},
...
Advice
0
votes
3
replies
61
views
How can an embedded database support PostgreSQL syntax without running a PostgreSQL server?
I'm experimenting with building an embedded SQL engine for Node.js and Bun.
The idea is similar to SQLite, but the engine aims to support a large subset of PostgreSQL syntax such as:
- joins
- CTEs
- ...
1
vote
1
answer
60
views
Why is the drop index showing inconsistent behavior?
I am getting an error thats says it cannot drop index as it does not exist, for code Sample B, but not for Sample A. The code samples are somewhat similar.
Here are the samples (run against a ...
Best practices
1
vote
3
replies
73
views
Safely validating AST of LLM-generated PostgreSQL queries in Java to prevent side effects
I am building a Text-to-SQL application where an LLM generates PostgreSQL queries based on natural language. These queries are executed against a database using a strict read-only user. However, as an ...
Best practices
0
votes
2
replies
83
views
Designing a database for a login and brute force attack detection system"
The goal of this project is to build a user authentication system (Web Login) capable of self-protection against brute force attacks by combining technical measures such as rate limiting, account ...