Questions tagged [postgres-14]

35 questions
0
votes
1 answer

Temporary table does not seem to get created inside SQL function?

I have created below function successfully, but get an error while executing it: temp table doesn't exist while executing the function CREATE OR REPLACE FUNCTION api."post_publish_Roster"() RETURNS void LANGUAGE 'sql' AS $BODY$ DROP…
nikhil raj
  • 55
  • 1
  • 10
0
votes
0 answers

Is there a way to use generated Identity PK (UUID as DEFAULT) using Eclipselink on Postgres 14?

I have a database running on postgres 14 RDBMS. This (relatively) late version has been selected specifically because it features UUID DEFAULT generation function. The application that uses the DB is JAX RS java application running within Payara…
helvete
  • 2,455
  • 13
  • 33
  • 37
0
votes
0 answers

sql add columns in group dynamically

It is necessary to build a summary table based on data about the customer and their payments, where the columns will be the sequential number of the contract (contact_number) and the year (year) grouped by gender. The main condition is that…
wdad asd
  • 35
  • 7
0
votes
1 answer

create pivot table with 2 dimensions

I have 2 tables: CREATE TABLE loans ( loan_id int, client_id int, loan_date date ); CREATE TABLE clients ( client_id int, client_name varchar(20), gender varchar(20) ); INSERT INTO CLIENTS VALUES (1, arnold, 'male'), …
wdad asd
  • 35
  • 7
0
votes
1 answer

Dangling transaction even though commit is called (node,Sequelize v5.21.9)

I have a route that uses the below shown method, in a node app that uses express. I create a transaction but don't use it in the update method. Sequelize is configured to not use managed transactions and auto commit is set to false. When this route…
0
votes
0 answers

Apply a Function to all Postgres IN (=ALL) queries

I am in an existing Postgres 14 database that has the following Operators and Functions in place that augment an '=' or 'LIKE' query to leverage 'lower()' (thus allowing the query to take advantage of Indexes). This is allowing us to do…
hp3ba
  • 1
  • 2
0
votes
1 answer

Connection error between Django and Postgres

I'm setting up an Amazon AWS test server with Django on which I use Postgres as a database. This was my way here: $ sudo apt update $ sudo apt install python3-pip python3-dev libpq-dev postgresql postgresql-contrib I downloaded my files from…
Sagittarius_A
  • 25
  • 1
  • 6
0
votes
2 answers

Randomly pick N distinct winners with weights for a raffle

I've been trying to find a solution to this problem for a day now. So, I have a table (raffle_tickets), from which I want to pick N distinct users, with their probability of being picked based on the sum of the number of tickets they bought, as the…
Pirulax
  • 80
  • 1
  • 7
0
votes
2 answers

Set DOMAIN for existing column

I have an existing table like this: CREATE TABLE public.data ( id integer, name text, sell_value real) ); and I define a domain as: CREATE DOMAIN dataDomain AS TEXT CHECK(name = ANY ('{joe, john, jack}'::text[])); How can I apply the…
Flammy
  • 25
  • 7
0
votes
1 answer

How to put argument (table name) of function?

I am using PostgreSQL 14.4 . My script -- 0. DROP TABLE IF EXISTS tenant; CREATE TABLE tenant ( id smallint primary key, company_tax_code character varying(14), period character varying(16), -- 2021070420220705 …
Vy Do
  • 46,709
  • 59
  • 215
  • 313
0
votes
2 answers

Difference between 'NOT IN' and '!= ANY'

PostgreSQL version: 14 I have a query that updates a jsonb field and removes items with certain IDs from it: UPDATE types SET elements = ( SELECT CASE WHEN jsonb_agg(element_obj) IS NULL THEN '[]'::JSONB …
Prosto_Oleg
  • 322
  • 3
  • 13
0
votes
0 answers

prisma seeding error: "remaining connection slots are reserved for non-replication superuser connections"

Postgres 14 prisma 2 Azure Database Faced an error during seeding development DB remaining connection slots are reserved for non-replication superuser connections I found that this error is caused by lack of connection pool. After some struggling,…
user14082
  • 311
  • 3
  • 10
0
votes
1 answer

How to loop through columns within a row

I have a row, let it be in this format DECLARE a t1%ROWTYPE; BEGIN SELECT * INTO a FROM t1 WHERE id= -- a = id: , name: "some_name", description: "some_descr" END; And I need to insert one row per column into t2 t2…
Prosto_Oleg
  • 322
  • 3
  • 13
0
votes
1 answer

How to calculate the difference between two timestamptz in Postgres

I have a table and I want to calculate the difference (in time) between two columns of my table. My columns are: scheduled_arrival_time(timestamptz), scheduled_departure_time(timestamptz) and I want to get the difference of them as…
enolic
  • 19
  • 4
0
votes
2 answers

Query Slower with different value for a parameter postgress

I´m with an issue where hibernate generates the following query on an existing view. select count(proclistvw0_.proc_id) as col_0_0_ from proc_list_vw proclistvw0_ where 1=1 and ( proclistvw0_.sub_group_edp_company = $1 or …
D Saggin
  • 403
  • 5
  • 12