Category "postgresql"

Updating Multiple Records with varying conditions in a single query

With Typeorm + NestJS + Postgres is there a way to update multiple records with varying conditions and varying values in a single query. Normally I could do awa

What difference does it make to put an annotation @Lob or not?

There is a request table in my database. Here is its structure Usually I created the entity with my hands, but this time I decided to generate it from the data

Is it OK to specify a schema in `table_name_prefix`?

TL;DR: Is it OK to specify a schema in table_name_prefix? We have a large Rails application that is not quite a traditional multi-tenant app. We have a hundred

How to SET ROLE for liquibase to use for DATABASECHANGELOGTABLE-creation

My current setup requires that the whole liquibase-migration is executed with a specific DB-role. I currently have the following changeSet on top of my script:

Inserting aggregates into big table is too slow

I need to run a query as cronjob and it is too slow to perform. It sums a value from a view table (data_time_series) for each pair of aks and ii and inserts a r

How to get the first field from an anonymous row type in PostgreSQL 9.4?

=# select row(0, 1) ; row ------- (0,1) (1 row) How to get 0 within the same query? I figured the below sort of working but is there any simple way? =# se

AssertionError: database connection isn't set to UTC

I have done server setup multiple times with the same settings but this time, I am seeing the error message. It is not even allowing to migrate the database. Sy

Quarkus docker container failed to run / connect to the DB

In my project, using Quarkus, Angular and PostgreSQL DB, when I run the backend & and the frontend in dev Mode, I can connect to the DB (which is postgreSQL

How to handle conditional prepared statements using prisma and postgresql?

I have a search query that its parameters changes depending on the client input. await prisma.$queryRaw(`SELECT column FROM table ${condition ? `WHERE column =

Is there any way to speed up this Postgres bitmap heap scan?

Database newbie here. This is my query, I'm using Postgres 9.3.5: =# explain analyse SELECT SUM(actual_cost) as cost, SUM(total_items) as num_items, proces

sqlite IFNULL() in postgres

What is the equivalent of SQLite's IFNULL() in Postgres? I have to following query (sqlite in Ruby): SELECT ifnull(max(code_id) + 1, 1) FROM configentries W

Translating an Excel concept into SQL

Let's say I have the following range in Excel named MyRange: This isn't a table by any means, it's more a collection of Variant values entered into cells. Exce

Using List inside a postgres Query

i have a dynamic list. list=['a','b','c','d' ..... ] so length may change i want to compare these list values in a query select * from student where name i

Postgresql pglogical subscription is down

I want to setup logical replication between two postgresql 9.5 servers. I could make it work on two virtual pc-s but when I try to do it on our production machi

Is there a way to match patterns from one column to other one?

I want to use club position and check if preferred_position contain the string then return True/False value for each row. Club_position Preferred_position RM R

How can I create a TypeORM Postgres connection with Heroku using Typegraphql?

I want to create a TypeORM Postgres connection with Heroku using Typegraphql, but I receiving the following error message: 'createConnection' is deprecated.ts(6

postgresql: FATAL: password authentication failed for user "douglas"

I am trying to migrate a DB from sqlite to postgresql...so I typed: sudo -u postgres psql postgres=# ALTER USER postgres WITH PASSWORD 'newpassword'; and the

How to get definition/source code of an aggregate in PostgreSQL?

I found this related answer useful: Export "Create Aggregate" functions from PostgreSQL But how do I get the CREATE AGGREGATE statement without a GUI client (

How to group multiple columns into a single array or similar?

I would like my query to return a result structured like this, where tags is an array of arrays or similar: id | name | tags 1 a [[1, "name1", "color1"

Combining Python variables into SQL queries

I am pulling data from an online database using SQL/postgresql queries and converting it into a Python dataframe using Pandas. I want to be able to change the d