Category "postgresql"

How To Sum Count Result?

I have a database that will count daily total amount of customer that does or doesn't have a transactions. Customer Column is a varchar data type Here is how

How to Run Postgresql procedures with Knex in Node js

I am trying to call a stored procedure saved in the public schema using: const schema = await knex.raw("call create_schema(?, 'col1', 'col2', 'col3', 'col4', 'c

postgresql not installed but homebrew reports it is

I've never had an issue like this before - normally brew install postgres works and everything is fine. I've had instances with this machine where I see "Mac OS

docker chainlink container not connecting to postgres database

I want to run chainlink node on my local ubuntu machine. I used the following commands to install postgresql: sudo apt install postgresql adjusting firewall se

Need some clarity on shell-script for Docker setup on Phoeinx project

I found below shell-script(entrypoint.sh) from some GitHub Phoenix repo and I saw the same code in multiple Phoenix projects #!/bin/bash # Wait until postgres

Order By Date desc evaluates 01-01-1970 higher then everything else

I have the following simplified query SELECT id to_char(execution_date, 'YYYY-MM-DD') as execution_date FROM schema.values ORDER BY execution_date DESC,

Postgresql truncate table with foreign key constraint

Currently I am trying to truncate tables which have foreign key constraint on Postgresql 11.3. I tried doing this BEGIN; SET CONSTRAINTS ALL DEFERRED; TRUNC

Strange queryplan jumps on partitioned table on old postgres 9.3

Our solution: We have a trigger based partitioned table. BUT the insert trigger return NEW because hibernate must have rowcount 1 so all insert is inserted pare

SQN Query has to return the clients of the user and the children of those clients

This is the query I have so far, which returns the customers of a user. But I need it to also return the children of these clients. SELECT c.id_client, c.uuid,

Sometimes one record from the set does not get into the database using EF Core and TimescaleDB

I faced pretty strange behavior in my tests, when only one record from the set is not added to the database and this happens from time to time, not always. Here

Unit Testing for pgxpool

I am looking to write unit tests for Go code that uses pgxpool to interact with a postgres database. Is there a test framework that will stand up a dummy or moc

Unable to access data in Postgres query where clause

I am dealing with the following JSON in a Postgres database column called steps in a table called tCampaign : [ { "name":"Step 1", "stepRefe

The proper way to achieve database locks (Pessimistic Read and Write) with TypeORM and NodeJS

I have an application that needs to deal with concurrency/race conditions. I noticed user account balances were being updated wrongly. Multiple requests can rea

How to deal with django migration postgres deadlock?

So, I was deploying the django app to production and then the infamous postgres deadlock situation happened. This happens during the django migration. Django ve

Error Object Id' is unknown when attempting to save changes. Adding Many to Many to the DB

I have objects with many to many relationship. public class Executor { public long Id { get; set; } public string Name { get; set; } public List&l

GraphQLError: Query root type must be provided

I'm using NestJS, TypeORM and GraphQL for my backend API. I'm getting the following error: GraphQLError [Object]: Query root type must be provided. at Sch

How to fill and access a Django ArrayField?

To solve my (kinda specific) problem, I found that I have to use Django ArrayField: https://docs.djangoproject.com/en/2.1/ref/contrib/postgres/fields/#arrayfiel

Query to update the column of second table based on newly generated id of first table

I have two tables company_types and companies_profiles. company_types_id of company_types and company_type_id of companies_profiles has one to many relationship

Postgres Sql - How to apply Offset on Timestamp

My offset-date-time object I store in the DB with 2 columns, one timestamp(UTC) column and another corresponding offset. For example, if I get: 2017-05-01T16:16

cannot access Postgres views from SSIS thru ODBC PSQL driver

I'm working with Postgres from SSIS thru ODBC Unicode driver ver 13.01. 32-bit connection. I can successfully connect to all Postgres tables but can not able t