Category "postgresql"

Syntax error when trying to insert record into posgtresql using pg8000 driver

When I am trying to insert a record into Postgresql I am getting below error. pg8000.exceptions.DatabaseError: {'S': 'ERROR', 'V': 'ERROR', 'C': '42601', 'M':

sequelize migration throws ERROR: function uuid_generate_v4() does not exist

I enabled uuid extension with CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; Then ran same query generated by sequelize for migration and it worked, create table i

Azure Postgres & Query Performance Insight: Query text not showing

I have enabled Query Performance Insights, however, the Query Text fields are left empty, as you can see from the screenshot below. I have enabled the Query St

mismatched input 'as'. Expecting: ',', <expression>

My query in PRESTO returns this error Query failed (#20220506_153121_03035_vycq3): line 6:41: mismatched input 'as'. Expecting: ',', I don't know why, anybod

How should I optimize the order by index

1.select * from transactions where from_account_id = 51118 order by block_number, index desc limit 20; Limit (cost=295.39..4973.89 rows=20 width=605) ->

Postgres SQL Query to total column with multiple filters

I have a Postgres table that contains a date and status field. I want to create a query that will return the date, plus the total number of records and then th

Inconsistency between postgres and hibernate

Inconsistency between hibernate and postres. Consider we have table student having 2 columns id(Primary Key) and name. Perform the following concurrent query on

Trying to use nominal typing for id in typeorm typescript

I was following this article TypeORM Best Practices using Typescript and NestJS at Libeo. I got to the point of using nominal typing in our entity ID @PrimaryG

Django constraints when removing columns in manual migrations

Django silently removes constraints when removing columns, then arbitrarily chooses to include them in migrations. I've encountered an odd bug(?) in Django in o

Django + Postgres: OperationalError FATAL: sorry, too many clients already (as a result of a deliberate attack)

There are many similar questions on Stackoverflow but they do not address my particular case. The problem is that there are deliberate attacks on the website wi

Reading incremental results from stored procedure

I am working on a stored procedure that will perform time consuming query (> 30 seconds) inside the engine (arrays, temp tables, ...). The stored procedure r

What does citext NULL mean in PostgresSQL

What does this mean in PostgreSQL columnName citext NULL Im working on some SQL change, there is data in the database, but doesn't show in the front end. Wonder

Rails Order by model method

How can I use the model method in scope for ordering? I have to order the users list, users who have failed go in the last. scope :position_ordered, -> { ord

Converting SQL Server DataRequest class to NpgSQL

Trying to convert a SQL Server DataRequest class for use with PostgreSQL. Stuck on the DBTypes in this code. Can anyone give me a hand in this conversion? /// &

spring boot transactional integration for event management

We have recently put a REST Spring Boot MVC application into production. We are using JPA with Postgresql in order to achieve some nonfunctional requirements: w

spring boot transactional integration for event management

We have recently put a REST Spring Boot MVC application into production. We are using JPA with Postgresql in order to achieve some nonfunctional requirements: w

postgresql function to process partitions separately

I have multiple loosely connected tables, all partitioned the same way by the same key: create table owner( user_id uuid primary key, owned_thing int ) partitio

How are months intervals internally calculated in Postgres?

In PostgreSQL, the interval of '1 month' sometimes counts as 30 days and sometimes counts as 31 days. What are the criteria used to determine this? I ran the be

How to use passed schema name dynamically in a function?

I have function called list_customers, taking i_entity_id, i_finyear as input params. The schema name is built from i_finyear, I need to execute the query based

How to use passed schema name dynamically in a function?

I have function called list_customers, taking i_entity_id, i_finyear as input params. The schema name is built from i_finyear, I need to execute the query based