Questions tagged [trigger]
Procedural code automatically executed in response to a database event.
1,529 questions
0
votes
1
answer
33
views
Enabled always statement level trigger on logical replication target does not seem to fire
Overview
I have the following setup using Azure PostgreSQL flexible server v17:
a main database containing a certain table included in the table list for a logical replication publication
a replica ...
0
votes
0
answers
47
views
Slow DELETE due to FK trigger on partitioned child table
I'm working with PostgreSQL 15 and experimenting with table partitioning to improve performance.
Original setup:
I have two tables: tasks (parent) with ~65M rows and records (child) with ~200M ...
0
votes
0
answers
16
views
How to solve ClassNotFoundException problem when creating trigger in Apache IoTDB 1.3?
I'm now in Apache IoTDB version 1.3.0 and want to create a simple trigger but encountering class loading issues. My trigger code:
`package com.example.trigger;
import org.apache.iotdb.trigger.api....
1
vote
0
answers
61
views
MariaDB: Drop database ddl-trigger in two-way replication setup
I have a database replication setup in MariaDB where the main database is replicated fully to the secondary database, and only a single table is replicated back in the opposite direction. I achieved ...
5
votes
1
answer
209
views
Order of execution of row-level triggers for multi-row INSERT
I have a trigger:
AFTER INSERT OR DELETE ON cryptokeys2020
FOR EACH ROW
EXECUTE FUNCTION update_domains_dnssec();
Then I:
INSERT INTO cryptokeys2020 (...)
SELECT ...
Example: cryptokeys2020 is empty ...
0
votes
1
answer
69
views
Trigger does not seem to respect condition
In my Postgres 15 database, I have a table with several geometric columns. I want a trigger to run on the field index_per when a specific geometric field is not null: geom_l93.
I have created a ...
0
votes
1
answer
102
views
How to add row numbers to deleted and inserted in after update trigger without sorting?
Consider the following example:
Create Table Test ([id] int, [value] varchar(max))
Go
Create Table Test_Log ([row_id] int, [action] varchar(11), [timestamp] DateTime default GetDate(), [id] int, [...
11
votes
2
answers
586
views
Trigger on cascading update target doesn't fire when the OUTPUT clause is used
I have 2 tables with the cascade delete rule - [dbo].[Invoices] and [dbo].[InvoiceRows]:
CREATE TABLE [dbo].[Invoices]
(
[InvoiceId] [int] IDENTITY(1,1) NOT NULL,
--other columns
...
1
vote
1
answer
59
views
Encrypting passwords in trigger
Using MySQL, for the Staff (User) table, I am using the triggers (Before Insert and Before Update) to encrypt the passwords that are saved.
Is there anything wrong with this approach?
0
votes
0
answers
50
views
Is there database design pattern that calls for the auxiliary table to store sequence numbers and how else can be applied?
I have table:
blocks:
id integer not null primary key,
ref_date date not null,
seq_no integer not null,
lk_document integer not null
there can be multiple records for each lk_document and all those ...
0
votes
2
answers
277
views
How to debug: "Trigger returned a resultset and/or was running with SET NOCOUNT OFF"?
I have a problem with trigger which produces the following error message
Trigger returned a resultset and/or was running with SET NOCOUNT OF
The trigger is structured like this:
CREATE TRIGGER ...
-1
votes
2
answers
85
views
MariaDB trigger using Substring gives error "Function does not exist, Check Function Name Parsing in the manual"
I have this trigger as a test. It has to do a lot more. It compiles/saves fine. But when I insert a row, I get an error
#1630 - FUNCTION databasename.SUBSTRING does not exist. Check the 'Function ...
0
votes
0
answers
30
views
Help with Creating an ERD and Logical Data Model for a Medical Management Application
A social security organization wishes to develop an application to manage patients, their attending a generalist, and specialist doctors. A person is either a beneficiary or a doctor; a doctor can ...
0
votes
1
answer
58
views
Trigger on pg_stat tables
I tried to create a system which changes the number of replicas in Postgres based on system metrics - latency, I/O operations, read/write frequency and CPU usage. I know that those metrics are ...
3
votes
6
answers
676
views
Data sanitation options on INSERT or UPDATE
The answer in this post is pretty much what I did to get my problem:
SQL Server trigger before insert or update depend on value
I have a CUSTOMER table that has multiple triggers attached. One of ...