Use this tag to indicate that your question is about PostgreSQL version 14. Questions concerning database administration should go to https://dba.stackexchange.com/
Questions tagged [postgresql-14]
227 questions
0
votes
1 answer
truncate partitions with foreign keys without cascade in postgresql
I have a schema like this:
create table thing
(
section uuid not null,
thing_id uuid not null,
alias_of uuid default null,
constraint alias_ref foreign key (section, alias_of)
references thing (section, thing_id),
…

scravy
- 11,904
- 14
- 72
- 127
0
votes
0 answers
Where Can I Find the The Setting.py File For PostgreSQL?
I am trying to install PostgreSQL to work with Django. I searched my hard drive for the PostgreSQL settings.py file but could not find what I was looking for. I found one under the PgAdmin folder (C:/Program Files/PostgreSQL/14/pgAdmin…

CodingSexagenarian
- 11
- 2
0
votes
1 answer
Optimise query: count latest win/lose streak for all teams
I'm not an expert in data-warehousing nor analytics, so I give birth to a monster-query that I'd like to optimise (if possible).
The problem is: I need to display the stagings table for a given tournament. This table should display team id, total…

Bohdan Shulha
- 74
- 10
0
votes
0 answers
dbt link to postgresql@13 instead of postgresql@14
Since installing postgresql@14 I have encountered an unwanted isse. By running dbt locally I get an error, specifically by running dbt debug following error message appears:
Encountered an…

Albin
- 822
- 1
- 7
- 25
0
votes
1 answer
ImportError: psycopg2 for creating engine
I've been trying to create a connection to my postgres DB. By doing so, I get following error by running this code
import pandas as pd
import numpy as np
import os
from sqlalchemy import create_engine, text
from datetime import datetime,…

Albin
- 822
- 1
- 7
- 25
0
votes
0 answers
Unable to connect to POSTGRES and showing error
I have a problem to connect server for Postgres after I installed it. When I try to psql -U postgres -h localhost it show this error:
psql: error: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061)
Is…

Muhammad Ihsan
- 1
- 1
0
votes
2 answers
How to improve PostgreSQL query performance when there are millions of records
We are trying to query millions of rows of data from 1 table (14 columns) in under 2 seconds if possible. This table is composed of more than 10 million records and is growing exponentially as live data is being written into it every second, every…

alanders
- 35
- 5
0
votes
0 answers
Postgres - cannot use subquery in DEFAULT expression
A new unique column is being added to a table. This column's value comes from a C# random code generator method, but for existing rows I need to rely on Postgres.
I have the following EF Core migration:
protected override void Up(MigrationBuilder…

Parsa99
- 307
- 1
- 13
0
votes
1 answer
How to insert array embedded inside a postgresql custom type
I have defined a new type
CREATE TYPE days_of_week as (
days integer[]
);
I have a table as follows:
create table rr( idd days_of_Week);
I am trying to insert an array in days_of_week like
insert into rr ( idd ) VALUES ( ('{1,3}') );
I…

Arun Gokule
- 13
- 2
0
votes
1 answer
Postgresql | remove all arrays that contains by others
Let's for example I have the next table:
CREATE TABLE temp
(
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
arr bigint[] NOT NULL
);
And insert rows it:
INSERT INTO temp (arr) VALUES
(ARRAY[2, 3]),
(ARRAY[2,3,4]),
(ARRAY[4]),
(ARRAY[1,…

Shay Zambrovski
- 401
- 5
- 21
0
votes
3 answers
PostgreSQL Streaming Replication Reject Insert
I have Postgresql 14 and I made streaming replication (remote_apply) for 3 nodes.
When the two standby nodes are down, if I tried to do an insert command this will show up:
WARNING: canceling wait for synchronous replication due to user…

Mohammed Alali
- 7
- 2
0
votes
0 answers
Postgres Update from 9.6 to 14.0 - speed of foreign table queries drastically reduced
After an update of Postgres from 9.6 to 14, accessing foreign tables in queries has become dramatically slower. The creation of materialized views based on foreign tables for example, may not terminate in 24 hours whereas it used to take a few…

Lokomotywa
- 2,624
- 8
- 44
- 73
0
votes
1 answer
calling function as SELECT field in Postgresql
I'd like to call a function (that returns a single string) as a field of a SELECT statement.
This is my function:
CREATE or replace FUNCTION getData(text) RETURNS text
AS $$ (select myField from myTable) $$
LANGUAGE SQL
IMMUTABLE
…

morphineglelly
- 107
- 7
0
votes
1 answer
Automatic Failover in postgreSQL 14
I have read that PostgreSQL doesn't detect server failure so it doesn't do automatic failover, but all the articles were in 2020 (two years ago).
My question is Does Postgres 14 need third-party software to do automatic failover? or is it built-in…

Mohammed Alali
- 7
- 2
0
votes
0 answers
Why Postgresql stored procedure not return table all columns?
I checked some StackOverflow answers for showing all columns in the table using stored procedure in Postgresql. And most of the answers says using function is the best practice for all columns shown. But I want to know what is the reason behind…

Tejas Mankar
- 108
- 1
- 7