Category "postgresql"

Querying pivot table to return a list of referred rows

I have these 6 tables and query which returns everything I want, but I want to add a new pivot table, so I can get a list of rows linked to it. Query: SELECT DI

Postgres array_position(array, element) sometimes 0-indexed?

Postgres method array_position(array, element), like other things in SQL, is 1-based. For example: SELECT array_position(array[4,5,6], 5) -- returns 2 But,

Postgresql Prune replicated data from outbox table

Problem Statement In order to ensure disk size isn't growing unnecessary, I want to be able to delete rows that have been replicated from my outbox table. Conte

invalid input syntax for type json aws dms postgres

I'm running a task that migrates all data from a postgres 10.4 to a RDS postgres 10.4. Not able to migrate tables which have jsonb column. After error, whole ta

Postgres, Node, Jest - Splitting testes into two suites results in deadlock

I have two suites of tests, one for Accounts and one for Transactions, accounts.spec.js and transactions.spec.js. I'm also using supertest. When I run them in j

PostgreSQL- Function to update 3 shared columns from table B on table A

The main goal is to create a function that updates 3 columns on another table (the update of the 2 columns from the first table trigger the update on the second

Table metadata transfer from sqlserver to postgresql using SQLAlchemy

I am trying to migrate my database from ms sql server to PostgreSQL using python script . Before migrating the data, script needs to create required tables. I i

postgres - how to kill all long running queries that match a particular query?

I have lots of background jobs that queue up the same query. I've been having a situation where they get stuck, and I'd like to kill the really long running que

Postgres LDAP authentication

I am trying to set up LDAP authentication with Postgres. I have user in my database with the same name as in AD and the following string in pg_hba.conf: host a

How to dynamic calculate value using formulas in postgresql

I'm in new this field. How do I manage the dynamic calculation with formulas and what steps to achieve the below output?. I have tables. Table 1 - Info_question

psql: how to exit with error if query returns 'False'?

I'm using psql to check if a table exists in a given database. The command below works fine to return t for True or f for False: psql -U $user -d $db -t -c "SEL

ULID native support in PostgreSQL [closed]

Does PostgreSQL support Unique Lexicographically Sortable Identifier (ULID) generator out of the box? It seems not. Does anyone know the best

Strapi giving me DB errors in production, even though I'm using correct credentials

EDIT: I found a file at /config/database.js which is used to connect to sqlite in development. When I change the client name from sqlite to postgres, that's whe

Argument of type '{ title: string; }' is not assignable to parameter of type 'RequiredEntityData<Post>'

I'm learning from Ben's Awad video: Fullstack React GraphQL TypeScript Tutorial. I ran into a problem with typescript. I don't understand why compiler thinks t

PostgreSQL Can't Convert String to double precision

So I'm asked to do this query for a college project: SELECT l.city AS name, AVG((pr.ap_price::double precision * 7 - pr.weekly::doub

How to get total likes count of a post from supabase backend?

I have two tables one for post and one for likes. Post table stores all the post information. Likes table has 3 columns id, post_id user_id Now I need help to f

ERROR IN POSTGRESQL: aggregate function calls cannot be nested

I get "aggregate function calls cannot be nested" error from PostgreSQL. I tried different bunch of things but could not solve. sum( case when sum(

size of exported objects with pg_dump

I used pg_dump with the directory format (-d) to export a database containing more than a hundred tables. By comparing the .dat file for a table with its size i

SSL connection to the postgresql ASP.NET

I am trying to connect to a postgresql database through SSL. In the appsetting.json file, my connection string is "DefaultConnection": "Sslmode=Require;Sslrootc

No Data encryption option for Azure Database for PostgreSQL

Based on this documentation of Azure, there should be a Data encryption option under Security. But I don't see any option of Security. Is there a way to enable