1,384 questions
2
votes
2
answers
202
views
MySQL: Soft Delete + Unique Constraint [duplicate]
I understand that soft deletion is useful for preserving data history and avoiding the need to manually handle child records.
However, soft deletion can cause issues with unique constraints.
For ...
1
vote
3
answers
224
views
Unique constraint to prevent overlapping ranges? To make sure a BETWEEN statement for two columns will always only return one row?
We have two columns, id_begins and id_ends. We use a BETWEEN statement to select the row where a specific id number will fit between the values in those two fields (including the begins and ends ...
3
votes
0
answers
86
views
Hibernate MappingException - Foreign key column count mismatch with referenced primary key
I am encountering an error when trying to save data using JPA and Hibernate. The error message is:
Caused by: org.hibernate.MappingException: Foreign key (FKi3uxs48nod3arim7hhpwx1anb:role_group [...
0
votes
1
answer
61
views
Duplicate Key violation unique constraint PostgreSQL History Tables
I have table_1 and table_1_history in PostgreSQL. I have setup a trigger for insert, update, delete on table_1. So any changes in table_1 will reflect to table_1_history and will create a new row. ...
1
vote
2
answers
127
views
Manage the order of updates when using a filtered unique index?
I have a filtered unique index defined as:
builder
.HasIndex(e => new { e.UserId, e.IsDefault })
.HasFilter($"[{nameof(MyEntity.IsDefault)}] = 1")
.IsUnique()
....
0
votes
0
answers
44
views
EF Core 9, inserting into a MySQL table with Composite Unique Constraint Best practice? [duplicate]
I'm working with a MySQL table that has a composite unique constraint on two columns (column1 and column2), like this:
CREATE TABLE example_table (
column1 INT,
column2 INT,
column3 ...
0
votes
1
answer
32
views
Odoo modue Event Registration duplicate key value violates unique constraint "utm_medium_unique_name"
Using the module Event (website_event_sale), there is an error occuring for some (few) of the customers in front office, when they click on the REGISTER-button that bring to the cart:
ERROR xxxxx-oerp-...
1
vote
1
answer
63
views
Does Hibernate support unique constraint inside @TableGenerator
I tried generating the values for my primary keys using @tableGenerator annotation. Since this annotation will create a table and generate the value from it, I want to place a unique constraint on the ...
0
votes
1
answer
181
views
pymysql.err.IntegrityError - 1062, "Duplicate entry - Unique constraint
Below is my update query :
update table_name
set Name = concat('zzzz', Name)
where ID = 100
The table has unique constraint on ID and Name -
UNIQUE KEY `UK_table_name` (`ID`,`Name`)
ID and Name are ...
2
votes
1
answer
56
views
Adding a unique constraint that includes a nullable value
I have the following entity model class:
public class RoutePermission
{
public Guid? UserId { get; set; }
public Guid? DistrictId { get; set; }
public Guid RouteId { get; set; }
public ...
1
vote
1
answer
100
views
Best practice for unique constraint: multiple columns VS generated column
I have several tables in which "whole" items are stored across multiple columns for each of their "parts," and I wish to ensure that the "whole" is unique. These tables ...
0
votes
1
answer
488
views
How can I avoid "ERROR: there is no unique constraint matching given keys for referenced table" on referencing combination primary key on Postgres?
I have the following table definition in the schema on pgAdmin4 I'm trying to execute:
CREATE TABLE IF NOT EXISTS Reporting
(
SEQ integer,
Product character varying(30) NOT NULL,
Version integer ...
3
votes
2
answers
1k
views
Why does PostgreSQL check a DEFERRABLE INITIALLY IMMEDIATE constraint after each statement?
I run the following SQL that never commits the transaction:
rollback;
begin;
create table testing_stuff (
id serial,
num integer NOT NULL unique deferrable initially immediate
);
insert into ...
0
votes
2
answers
152
views
Type Error while populating a model in Django with UniqueConstraint
I'm trying to build up my first project in Django and I'm having some issues while creating an entry into my model Prevision (including sales forecasts), which has a uniqueConstraint to ensure that ...
0
votes
1
answer
117
views
How to Create a Case-Insensitive Unique Compound Index in MongoDB?
How to Create a Case-Insensitive Unique Compound Index in MongoDB?
Question Body:
I'm trying to create a compound unique text index in MongoDB with the following fields:
tenant_id: 1
seller_id: 1
...