We migrated from SQL Server to Postgres and I am trying to rewrite a stored procedure. The procedure is created correctly, but I can not call it. This is my procedure: CREATE OR REPLACE PROCEDURE …
Tag: postgresql
Nasty sql error(POSTGRES) “There is no unique constraint matching given keys for referenced table…”
EDIT: tables have been translated from my language to english i’ve changed te reference of foreign key in table Comment to “Utente” -> “User” Hi everyone i’m trying to build a small review system in sql as follows. Every user can comment on some item(could be anything) a…
How do I replace dynamic values?
In my PostgreSQL database I have such table: | employee | question | answer | |———-|——————————|————| | Bob | What is your favorite color?…
How do I select a PostgreSQL system column using SQLAlchemy?
Postgresql implicitly defines several columns on every table, such as xmax and ctid (see docs). Assuming my SQLALchemy table definition does not specify these columns, is there a way to select them using the core sql functionality (i.e. not the ORM part of SA)? The following does not work as xmax is not expli…
SQL SELECT Query Performance between AND and Interlaced SELECT´s
Good evening. I am new to SQL and I am currently learning how to write SQL SELECT statements. I read a lot about the difference of performance between different ways of writing SELECT statement. I am …
Managing multiple categories trees, using Python and PostgreSQL
I have multiple categories, which can have None or one or multiple sub-categories. The process theoretically can go to infinite. So, it is like having multiple trees. Tree example. I have also Item(s). An Item can be in multiple categories. At this moment to connect the categories, in database I use three fie…
Whats the disadvantage of setting a too high batch size?
I set the batch_size in application.yml: spring: profiles: dev jpa: properties: hibernate: generate_statistics: true jdbc: batch_size: 20 Whats the reason …
Find by multiple columns and rows criteria sql query
I have Paths and Criteria tables in PostgreSQL. Paths have multiple criteria that should be fulfilled to be selected. Path table with (id, name), Criteria table with (id, key, value, path_id) I …
How to calculate a non-inflated count from a denormalized table
Suppose I have a denormalized table that includes an ID and a value that I need to count. Something like this: In this case, select Tree_ID, count(Count_If_True) from Table group by Tree_ID would show: But If I denormalize my table further with a join from an Apples table (where every tree has multiple apples…
query to update records count based on relation and constraints
Im trying to update a column (address_count) on my people table that must have the sum of records from another table (people_addresses) plus some constraints. The idea is that, the record on people must exist on people_addresses and must be present on at least one of the other tables (table a, table b) With t…