Category "postgresql"

Creating Custom Join in Django

I am struggling to create the correct prefetch behavior in Django. Here is the outline of the problem: Each Account has DailyQuotes, updated daily at different

PostgreSQL duplicate key value violates unique constraint while using on conflict do nothing on insert

Table def: CREATE SEQUENCE IF NOT EXISTS lazy_product_stock_id_seq; CREATE TABLE "public"."lazy_product_stock" ( "id" int4 NOT NULL DEFAULT nextval('lazy_pr

Generating counts of open tickets over time, given opened and closed dates

I have a set of data for some tickets, with datetime of when they were opened and closed (or NULL if they are still open). +------------------+-----------------

How to upload and use images on heroku django

so i make this app in which you can make products. And those products have an image that was saved in a file while i was using this app localy. I deployed my ap

persistence jsonb field to h2 using hibernate

source code I want to use jsonb column type. When I used postgresql there is no problem. But when I use H2 I can not persist my entity. Native sql works but whe

postgres default timezone

I installed PostgreSQL 9 and the time it is showing is 1 hour behind the server time. Running Select NOW() shows: 2011-07-12 11:51:50.453842+00 The server dat

Connect a python-run PostgreSQL database to a flutter web app

I am currently developing a flutter web app for tracking the information in students classes. The app is basically a task management app curated for students. I

Django with postgresql deployment on aws elastic beanstalk

I’ve been trying to deploy a django application with postgresql db on aws elastic beanstalk and i ran into many issues that i surfed and solved. Now the a

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