326 questions
1 vote
2 answers
99 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
1 answer
121 views
Why does the same query breaks when upgrading from postgre 14.17 to 14.19 when using timestamp?
After our provider upgraded our pg-14 database from 14.17 to 14.19, with timescaledb extension 2.5.2, our app completely broke because of awful database performances. Our analysis showed that the ...
0 votes
0 answers
45 views
Why does Hibernate throw "cannot execute UPDATE in a read-only transaction" after a COUNT query when no join entries exist?
I am encountering a puzzling issue in Hibernate (with PostgreSQL backend) and would appreciate confirmation or correction of my understanding. Context: I have a method that runs a couple of scalar ...
0 votes
0 answers
51 views
PostgreSQL SSL Replication: Why is WAL Sender Encrypted but Not WAL Receiver?
I am setting up SSL encryption for PostgreSQL replication and have the following configuration: PostgreSQL Version: 14.3 OpenSSL Version: 3.1.0 Configuration Details: I have enabled encrypted ...
0 votes
0 answers
35 views
Why is PgBouncer v1.21 Assigning Different Names to the Same Prepared Statement?
I'm trying to use prepared statements with PgBouncer v1.21 in transaction mode for PostgreSQL 14.3. While enabling prepared statements via PgBouncer, I followed this blog and used the sample code ...
0 votes
0 answers
265 views
Why is max_prepared_statements = 1 allowing multiple prepared statements in PgBouncer?
I set max_prepared_statements = 1 in PgBouncer and attempted to create multiple prepared statements within a single transaction. Expected Behavior: PgBouncer should either prevent more than one ...
0 votes
1 answer
111 views
Unable to create schema for Postgres database using sqlalchemy
I'm able to create a schema via the command line using CREATE SCHEMA test_schema;. However, running the following code doesn't create a schema: from sqlalchemy import create_engine from sqlalchemy....
1 vote
1 answer
228 views
PostgreSQL: Can't remove old role from brew install
I'm trying to completely uninstall and then reinstall a clean version of postgresql via homebrew. Following various SO and other guides I've run the following commands to clear out the existing ...
0 votes
0 answers
106 views
Alter tablespace of existing database in Postgresql
I have a database located in default tablespace named "pg_default". Due to space limit in directory, I need to alter tablespace of my database to new custom tablespace. How I can do that ? ...
1 vote
2 answers
86 views
Get all data COUNT fastest from large table based on condition
I have the table with 10TB of data. I want to perform the COUNT(1)/COUNT(*) to check the EXACT COUNT between main table and archive table. I tried following SQL's but didn't get optimal solution, ...
0 votes
3 answers
91 views
Generate timestamp series between given dates
Given min and max dates are: Min date: 2023-06-19 09:54:23.000 Max date: now()::timestamp(0)-interval '1 year' Expected output: start_date end_date --------------------------------...
0 votes
1 answer
50 views
syntax error when creating an if statement on postgresql function
I'm learning postgresql and am trying to create a function. I have code like this: create or replace function test_function(current_uncertainty float, last_updated timestamp, min_uncertainty float) ...
1 vote
1 answer
78 views
PostgreSQL INSERT INTO SELECT with multiple tables
When doing bulk inserts is it possible to insert into two separate tables and add the relationship? So I have something like this: create table collector ( id int4 generated by default as identity ...
1 vote
1 answer
89 views
GIN index not being used with NOT?
I have a table with a column itemsIds containing an array of ids. I have created a gin index for that column. I'm trying to find rows that don't contain an element with the following query: select * ...
2 votes
0 answers
126 views
Vacuum full Out of Memory Error PostgreSQL
I have some large tables in my database that I need to perform a FULL VACUUM but keep getting out of memory error. I am not sure what is the problem. Memory parameters: -free -g = 23 -shared buffer = ...