Use this tag to indicate that your question is about PostgreSQL version 13. Questions concerning database administration should go to https://dba.stackexchange.com/
Questions tagged [postgresql-13]
368 questions
0
votes
1 answer
How to get values from the previous row?
I have a table like this:
ID
NUMBER
TIMESTAMP
1
1
05/28/2020 09:00:00
2
2
05/29/2020 10:00:00
3
1
05/31/2020 21:00:00
4
1
06/01/2020 21:00:00
And I want to show data like this:
ID
NUMBER
TIMESTAMP
RANGE
1
1
05/28/2020…

Triaji Setiawan
- 45
- 1
- 1
- 8
0
votes
1 answer
Postgres 13 + pglogical 2.3.4 on an existing dataset
I'm experiencing an issue trying to setup pglogical between a provider and a subscriber, both already have some data in common.
This is a minimal script to reproduce what I'm trying to do:
CREATE DATABASE db1;
\c db1;
CREATE EXTENSION…

Andre Galastri
- 1
- 1
0
votes
1 answer
Citus "... is a metadata node, but is out of sync HINT: If the node is up, wait until metadata gets synced to it and try again."
I've got a Citus (v10.1) sharded PostgreSQL (v13) cluster with 4 nodes. Master node address is 10.0.0.2 and the rest are up to .5 When trying to manage my sharded table, I've got this error:
ERROR: 10.0.0.5:5432 is a metadata node, but is out of…

Mr.TK
- 1,743
- 2
- 17
- 22
0
votes
1 answer
How to convert SQL Server merge with deleted and inserted output
I'm doing an SQL Server to PostgreSQL migration and there are a lot of procedures which are like the below, where we need access to both the inserted / update and deleted data:
CREATE PROCEDURE dbo.CGTACCUMULATED_INSUPD
@AccID int
, @Input…

RLOG
- 620
- 6
- 14
0
votes
0 answers
Is it possible to automate index creation in PostgreSQL natively?
Is it possible in PostgreSQL (as of version 13) to automate index creation without making use of external dependencies?
As an example, imagine we are adding partial indexes on a date field, and we want to keep a separate index for each month (ex.…

Z. M.
- 329
- 5
- 13
0
votes
0 answers
Postgres 13 - SCRAM-SHA-256 client password must be a string
I have been using Postgres 12 with MD5 as authentication method and have not faced any issues when trying to connect to a database with password. Nor have I faced issues with user authentication when supplying user password.
However, since I have…

Ananta K Roy
- 1,848
- 2
- 14
- 16
0
votes
1 answer
Looping JSON Array in JSONB field
I want to loop over JSONB column and get certain values (price, discount_price, and currency) of relevant JSON objects to my filter. But I get this error:
syntax error at or near "FOR"
Value of the parts column which is JSONB:
[
{
…

Ulvi
- 965
- 12
- 31
0
votes
1 answer
Converting local datetime values to UTC datetime values in SQL Server and PostgreSQL
I am trying to understand the behavior of AT TIME ZONE and I get some strange behavioral differences between SQL Server and PostgreSQL in this regard.
For demonstration purposes I produced two queries, one for SQL Server and one for PostgreSQL.
The…

Bart Hofland
- 3,700
- 1
- 13
- 22
0
votes
2 answers
POSTGRES JSON: Updating array value in column
I am using POSTGRES SQL JSON.
In json column the value is stored as array which I want to update using SQL query
{"roles": ["Admin"]}
The output in table column should be
{"roles": ["SYSTEM_ADMINISTRATOR"]}
I tried different queries but it is not…

Nitin Mukesh
- 4,266
- 6
- 22
- 26
0
votes
2 answers
how to count postgresql user login
I am trying to find out total number of postgresql users login details in month but I am not able to find. I have checked pg_stat_activity table and other tables as well but not getting the details
select count(*) as session_count
from (
select…

Sadamh Hussain
- 1
- 2
- 6
0
votes
1 answer
Is Postgres ON CONFLICT DO NOTHING performant on tables without auto-incrementing IDs?
I'm aware that failed upserts will cause an increment in auto-incrementing fields, but are there any other considerations to keep in mind when using ON CONFLICT DO NOTHING when inserting millions of rows continuously?
Will it cause any other type of…

Z. M.
- 329
- 5
- 13
0
votes
1 answer
How to successfully remove a tag from a book in Java?
I'm working on PubHub 100 project. One issue I'm facing is that when I press the button to remove a tag from a book, the webpage returns an exception. During the course of this project, I have used Java Development Kit, Eclipse to write and run java…
0
votes
1 answer
PostgreSQL syntax error at or near "SELECT"
I have no idea why this error is appearing. The query was working fine and then I tried making it prettier and then this happens
UPDATE "topTenCategories" SET "membersCount" = "tempTable"."newVal" FROM
(
VALUES
(
…

LukeWarm2897
- 149
- 3
- 14
0
votes
0 answers
Error in INSERT INTO while creating TIMESTAMP from DD-MM-YY HH.MM.SS input
UPDATE: With a more articulate example.
there are create queries mentioned in below link written in MySQL syntax, can you create them the similar way in postgres wrt timestamp…

Priyal Mangla
- 97
- 8
0
votes
1 answer
How to return custom value from function call?
I am trying to call a function called account.user_available_sel in PostgreSQL 13 which returns a table of data. It is very simple like this:
SELECT * FROM account.user_available_sel(_email => 'email@xxx.xxx');
The SELECT * part returns back the…

volume one
- 6,800
- 13
- 67
- 146