Skip to main content

Questions tagged [postgresql]

All versions of PostgreSQL. Add an additional version-specific tag like [postgresql-13] if that context is relevant.

Filter by
Sorted by
Tagged with
3 votes
1 answer
105 views

Given two tables counter and cnt_source defined like this: create temporary table counter (key bigint, count bigint); create unique index counter_key_uniq on counter (key); create temporary table ...
DS-Charlie's user avatar
0 votes
1 answer
51 views

When writing SQL queries against a large PostgreSQL database, I am seeing phantom reads despite setting the transaction isolation level to READ COMMITTED. Can you provide a concrete example of a multi-...
Awais Khan's user avatar
1 vote
1 answer
32 views

I am creating a new user and granting them the pg_read_all_stats privilege so they can monitor all pg_stat_* views. However, when I monitor pg_stat_activity through this user, other users' operations ...
Abdullah Ergin's user avatar
0 votes
0 answers
34 views

On a PostgreSQL 14 database, I've got a logical replication publication of 108 tables across 10 schemas. For some unknown reason, the subscriber fails to replicate tables in one of the schemas (call ...
JK Laiho's user avatar
  • 175
0 votes
1 answer
30 views

I have been testing PostgreSQL 17 AYSNC replication and failover on Ubuntu VMs. Suppose I have two VMs: A as the primary and B as the standby. If I promote B while A is offline, and later configure A ...
goodfella's user avatar
  • 700
0 votes
0 answers
49 views

I have an SQL query with a subquery, like this: SELECT field1, json_agg(json_object('key', field2, 'total', "total") order by field2) as "my data" FROM ( SELECT field1, ...
Sergey Zaykov's user avatar
0 votes
1 answer
32 views

Overview I have the following setup using Azure PostgreSQL flexible server v17: a main database containing a certain table included in the table list for a logical replication publication a replica ...
Alexei's user avatar
  • 1,193
0 votes
0 answers
48 views

Problem Summary My automated PostgreSQL backup script using pg_dump was working fine until a few days ago. Now it consistently fails with a connection error during the COPY operation on the alternate ...
zeewagon's user avatar
  • 101
0 votes
1 answer
23 views

I'm attempting to migrate (users, structures, triggers, data - everything) a postgres 17 database on a windows 10 machine to a new windows 11 server. The new machine has a default installation of ...
ConanTheGerbil's user avatar
0 votes
1 answer
50 views

I just discovered that logical replication doesn't work between different schemas, like you cannot publish schema1.table1 in server1 to schema2.table1 in server2. In my setup, I have multiple servers ...
sophia sophia's user avatar
0 votes
1 answer
83 views

I have a PostgreSQL 17 database that unfortunately requires queries that are very dynamic and hard to optimize. The part that I want to ask about are queries that need to order the results by some ...
Fabian's user avatar
  • 117
2 votes
1 answer
86 views

I get the following error when trying to send queries to a Postgres server in hot standby: BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY; COMMIT; And the error: SQL Error [...
user avatar
0 votes
2 answers
70 views

We need to process XML data, and struggle with this. I followed some XML with PostgreSQL tutorials, and all was fine. Then I wanted to import XML files, around 30-40kB, exported from a diagram Editor. ...
HansDampfVN's user avatar
0 votes
0 answers
17 views

I want to detect the size of a table in postgres. 2 approaches: size of datafile on fisk pg_table_size() according the below I get hugely different results (77M vs 279GB) and am guessing ...
vrms's user avatar
  • 293
3 votes
1 answer
123 views

We are converting a database from SQL Server 2022 to Postgres 18. Our system has a lot of code in the database and a lot of queries that use local temp tables a lot more than CTE's. This is due to the ...
Mark Gibson's user avatar
2 votes
1 answer
62 views

I'm using PostgreSQL 16+ and working extensively with jsonb columns using JSON subscripting paths (as described here: PostgreSQL docs – jsonb subscripting). I've run into an issue when updating nested ...
Krrish's user avatar
  • 21
0 votes
0 answers
45 views

I'll say in advance that I've seen similar questions on this topic, but I just couldn't find an answer because they concerned long queries, while mine, on the contrary, executes the query in less than ...
UKRman's user avatar
  • 101
0 votes
0 answers
53 views

I’m testing logical replication in Postgresql 15 to replicate tables across several servers. Some of the subscribers may be offline for months, which eventually invalidates their replication slot on ...
sophia sophia's user avatar
0 votes
1 answer
87 views

I have two PostgreSQL16 clusters (one cluster per server) each with one and the same database. They are interconnected via a bi-directional logical replication, with one being the main one and the ...
coyote's user avatar
  • 101
0 votes
1 answer
63 views

The problem (short version) I have to import data from files to PostgreSQL, and this has to be done on the server side. Files are uploaded to the PostgreSQL server and then imported to the database by ...
jgrocha's user avatar
  • 395
2 votes
1 answer
225 views

PostgreSQL do the join with an UNNEST result table as a INNER JOIN. Where is this described in the documentation? Why not a LEFT JOIN? Example: CREATE TABLE products ( id INT, tags TEXT[] ); ...
Cirelli94's user avatar
  • 123
0 votes
1 answer
48 views

When running the following query, I would expect it to give the same result independently of the session time zone but instead it gives different result depending on the session: select '2025-09-22' &...
vgfeit's user avatar
  • 15
0 votes
1 answer
35 views

I'm exploring the module wal2json for the first time. I've set up the replication slot using the ReadMe examples. When peeking the replication slot, every data value begins with an "action" ...
Peter Vandivier's user avatar
2 votes
1 answer
101 views

Is it possible to create a table that is built from an inner join of two other tables with additional columns, but where the rows are kept updated when the inner join is re-run? Currently using ...
brendans-bits's user avatar
0 votes
1 answer
68 views

Table Definition CREATE TABLE public.table_1 ( id bigserial NOT NULL, generation_date date NOT NULL, "namespace" varchar(16) NOT NULL, item_id int8 NOT NULL, ...
Aditya's user avatar
  • 101

1
2 3 4 5
350