Questions tagged [postgresql-13]

Use this tag to indicate that your question is about PostgreSQL version 13. Questions concerning database administration should go to https://dba.stackexchange.com/

368 questions
1
vote
1 answer

How to use a temp sequence within a Postgresql function

I have some lines of SQL which will take a set of IDs from the same GROUP_ID that are not contiguous (ex. if some rows got deleted) and will make them contiguous again. I wanted to turn this into a function for reusability purposes. The lines work…
Braedon
  • 41
  • 1
  • 5
1
vote
1 answer

PLPGSQL function returns ERROR: integer out of range even if value is correct

I'm experiencing strange behaviour on two Postgres functions returning a single bigint value. The first one returns the correct value while the second one throws an error: ERROR: integer out of range The only difference is that the first one…
1
vote
1 answer

Unique constraints name on partitioned tables

I'm using partitioned tables for multi-tenant application and I have to check unique constraint name to return suitable error. How I can check unique constraint name in each partitioned table? How unique constraint name in partitioned table is…
kpanic
  • 13
  • 2
1
vote
1 answer

Equal sign (=) and LIKE return different results on main and replica postgresql

In my setup I have one main and two replicas PostgreSQL-13 servers. On the main and one of the replica servers I have the following (normal) situation when running queries: SELECT id, field FROM table WHERE table.field = 'some.string'; id | …
Dexterite
  • 113
  • 1
  • 4
1
vote
1 answer

How pgpool-II getting node information?

I want to know where from pgpool getting those node information. I am getting node information using below command but unable to find from where it is getting those data. Is there any database or table or function for pgpool from where it is getting…
1
vote
1 answer

"cannot assign non-composite value to a record variable " while storing result in array

on Postgres 13 I have a trigger execute ON UPDATE of a table. In this trigger I want to store in an array a result from a query, because I will need to use it inside an inner iterator, multiple times. In this way I avoid performing the same query at…
Deviling Master
  • 3,033
  • 5
  • 34
  • 59
1
vote
1 answer

Error on pg_logical_slot_peek_changes: client sent proto_version=0 but we only support protocol 1 or higher

I'm trying to call the function pg_logical_slot_peek_changes with PostgreSQL 13 on a replication slot, but I always get the following error: ERROR: client sent proto_version=0 but we only support protocol 1 or higher CONTEXT: slot "test_slot",…
djed
  • 141
  • 10
1
vote
0 answers

Getting different output of a function in different PG servers

I have migrated my database from postgres version 9.6 to postgres version 13, So I am facing a issue where a function returns different output in both the versions. I am explaining the problem with dummy data because my actual function and type is…
Jay Godhani
  • 368
  • 2
  • 12
1
vote
1 answer

How do combine two Queries or is it only one?

Question: How do combine two Queries or is it only one? Example: I have two exact similar tables my PostgreSQL Database. info_table and info_table_dump with the exact same columns date_at, name, color and length . Now i want to know if there are…
black_hole_sun
  • 908
  • 11
  • 41
1
vote
0 answers

Creating sub-partitioned tables without locking the parent table

I am using Postgres 13. I have a table (accounts) with around 100 million records, that is (hash) partitioned in to 50 tables (based on the user_id) This is then further (range) partitioned into 14 tables each, based on the day of transaction. Every…
1
vote
1 answer

Adding a User to Already Created Database - Give Full Read Access

I have been stuck on this problem for a while now and cannot figure it out. Hoping someone can help me. I think my situation is pretty simple, so I feel extra stupid for having to post this Nonetheless -- I have a database, lets call it tempdb,…
dmcmulle
  • 339
  • 3
  • 11
1
vote
1 answer

pglogical: list array/schema/table part of the replication sets?

Is there a way to list the Array/schemas which have been added to the replication_set? # SELECT * FROM pglogical.replication_set; set_id | set_nodeid | set_name | replicate_insert | replicate_update | replicate_delete |…
1
vote
1 answer

ALTER DOMAIN CHECK in POSTGRES

The syntax for ALTER DOMAIN IN POSTGRES DDL allows for CHECK condition to be changed provided a named constraint exists. How should one change a CHECK defined in a domain which does not specify a named constraint Say the original constraint is as…
Sudheer Hebbale
  • 421
  • 5
  • 11
1
vote
1 answer

Loop inside the function runs as a single transaction and reads data of a single snapshot

I am writing the function to collect rows from pg_stat_activity system view (PostgreSQL 13). Inside this function I have a simple loop to insert the pg_stat_activity data into log table. The problem is when I run the function it inserts the rows…
1
vote
1 answer

Identify json type in postgresql

Is there a function - or a way to easily determine the json data type in postgresql? For example: select key, value, pg_typeof(value) FROM jsonb_each('{"foo":1,"bar":"2","ack":[1,2,3]}'::jsonb) Returns: key value pg_typeof ack [1, 2, 3] …
Paul
  • 3,634
  • 1
  • 18
  • 23