Category "postgresql"

Store JSON array as TEXT array in INSERT INTO Postgres statement

Before, I had the following table schema. CREATE TABLE cities ( "city_id" BIGSERIAL PRIMARY KEY, "city_name" TEXT NOT NULL UNIQUE, "employees_names"

Listing tables USED BY materialized view in PostgreSQL?

I've googled for it, both couldn't find an answer. How can I list tables used by materialized view (must not use the information_schema views) in PostgreSQL? Th

Postgresql argument placeholder in jsonpath expression

I try to pass argument $1 to jsonpath-expression: SELECT 1 FROM %s.orders AS O WHERE order_info @? '$.items[*] ? (@.ProductID == $1)' but it doesn't work. P

Postgresql database autoscaling in GCP

I have an app that spikes postgresql queries at morning 70% CPU usage, and has very few the rest of the day less than 20% usage. I want this machine to autoscal

Update a table with its relations in TypeOrm

We have: Postgres Database Photo: import {Entity, PrimaryGeneratedColumn, Column, ManyToOne} from "typeorm"; import {User} from "./User"; @Entity() export clas

NestJS app build with docker can't access postgres database in the same docker network: ECONNREFUSED 127.0.0.1:5432

I want to run my app on my local machine within Docker. I don't want to optimize the size of my docker app or build it for production now. Docker builds my back

how to insert value for bit column of postgresql with jdbc

If the preparedStatement sql is fixed, how can I do the insert? table schema create table if not exists ttqs_a (b bit(1)); code try(PreparedStatement ps = conn

Postgresql failed to start. Reboot is resetting the permission given to /var/run/postgresql/

FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.1111.lock": Permission denied psql: could not connect to server: Connection refused Is

Laravel eloquent query with filter "where ILIKE" does not match with any value with accent saved in my Postgre database (encoded in UTF8)

I have a Laravel 5.8 app. It works with a Postgres Database encoded with UTF8. I have a query for my users table, so i made my query as: $users = User::where

Get number of associated elements in Sequelize

So I have a many-to-many relationship with Sequelize. This code gives me an array of all the categories associated with the Post. It works to get this data. How

postgres logical replication starting from given LSN

Postgres logical replication initial synchronization is very slow process, especially if original database is quite big. I am wondering if it possible to start

How to force COMMIT inside function so other sessions can see updated row?

In a Postgres 12 database, I have multiple queries (SELECT, UPDATE, ...) in a function that all together take about 20 minutes to complete. I have a check at th

AWS - DMS for Postgres RDS cutover strategy

To prepare for our Postgres to Postgres migration we have configured a DMS task and a target DB with migrations pre applied. We tested DMS and a cutover to our

How to fix: No changes in database schema were found - cannot generate a migration?

I searched a lot and there are several questions like this however most of them do not have any answer or are not relevant to me. I'm using TypeORM(v0.2.45) wit

Is it possible to have a read replicas of azure flexible postgresql server with a subset of data?

Is it possible to replicate a specific subset of data (certain schema,dbs') to a readonly copy of Azure postgres flexible server. Thanks Brian

Why doesn't Copy or \copy work for me in Pgsql?

I am trying to import data from a csv into postgres. I have tried the following and got the following errors: Copy TA_Files FROM 'C:\Users\ABla47\Documents\TA

Create a postgresql function that returns a string 'fall', 'spring' depending on year

I need to create a function that returns the string 'fall' or 'spring' depending on the month of the year. If the function was named getterm and took no paramet

Malformed MIME header error in Symfony 5.3

I'm working on a project with Symfony 5.3 with PHP 8.0.12. I've been developing it on my own computer, it's working well. I now want to deploy it on a remote co

PostgreSQL 12.2 with Sequelize 6.3 - UPSERT a array of data and want ON CONFLIT DO UPDATE to merge current existing JSONB and EXCLUDED JSONB

I'm currently using this query to insert or update my array of data when retrieving my list : try { const query = `INSERT INTO "Tables" ("id","tomerge

Error: 'duplicate key value violates unique constraint' even when checking with 'where not in'

I get the error: 'duplicate key value violates unique constraint' even when checking if the primary key is already in the table in which I want to insert. I ha