0
votes
1answer
13 views

postgresql trigger: disable auto commit and set isolation level

i'm writing a trigger on database INSTEAD OF INSERT ON a table, that made some operation, then insert data into different related tables. Now i need to disable autocommit and set a different isolation ...
0
votes
0answers
21 views

Postgresql trigger: contents of update record [duplicate]

I am trying to write an audit trigger for a database in postgresql. This audit log should record date, time, user etc., but also the specific values that were updated. My challenge is in ...
2
votes
1answer
32 views

Is there a way to disable updates/deletes but still allow triggers to perform them?

Basically, I want to be able to use the REVOKE command to disable UPDATE and DELETE, but I still want the triggers on a table to update my rows. My triggers perform on newly inserted rows, and update ...
0
votes
2answers
26 views

Trigger: execute query that fired it if condition is verifyed

I'm working on postgres, and i would know if there's a easy way to execute inside trigger the invoking query without write it again inside trigger. I'm explain myself. I have a INSERT query on a ...
0
votes
0answers
16 views

Check each value have already exceeded the limit in PostgreSQL with trigger and rise a notice

What I want here is to get which subject has already 4 classrooms, if it exceeds raise a notice and return null, and works. But when I insert other subject "2" the code raise the same notice, but I ...
0
votes
0answers
37 views

SQL after trigger not counting correctly

I have two tables, tasks and subtasks. Every subtask has a status (PENDING when first inserted). Then I run threads that update every subtask (the status becomes READY). What I want is when every ...
0
votes
1answer
46 views

Postgresql - trigger adds twice

I have many triggers in my tables, but one behaves not exactly like I want it. This one counts products and price and returns total price for order - works ok: CREATE OR REPLACE FUNCTION ...
0
votes
1answer
38 views

PostgreSQL Stock Update Trigger

I have 2 tables in PostgreSQL: lines(idlines,iditems,quantity) and items(iditems,stock). iditems is a foreign key in lines. I need a trigger that updates the stock field from the items table when a ...
0
votes
3answers
49 views

postgres update rule wont insert

i have a simple table: CREATE TABLE aaa_has_bbb ( aaa_id integer not null, bbb_id integer not null, rank integer not null, primary key(aaa_id, bbb_id), uniq(aaa_id, rank) ) I ...
-1
votes
1answer
23 views

PgSQL trigger on a view with storage's rule

I apologize in advance for my English; I have a problem with the trigger on the view of the rule of storage trigger looks like this: CREATE TRIGGER AFTER INSERT ON add_count test.v_wszystkie FOR EACH ...
0
votes
1answer
41 views

PostgreSQL - set a default cell value according to another cell value

If i have a column say column a of any given values, and i want another column column b to have a default value according to the value of column a In another words: if column a = 'peter' then column ...
0
votes
1answer
28 views

Postgres avoid Trigger on delete cascade

Hello i have a problem with a Trigger i have 2 tables: t_mandant t_user_has_mandant when i delete a row in t_user_has_mandant i call a trigger beforeDeleteUserMandant() but i need a possibility ...
0
votes
1answer
102 views

Custom auto-increment field in postgresql (Invoice/Order No.)

The baseline requirement is to create an order number in the format: (M)M-SSS Where MM represents the current month and SSSS represents the order sequence for that month. For example 1-002 would ...
0
votes
1answer
84 views

Select a column default value into a variable in Pl/PgSQL

I'm trying to implement a generic trigger procedure to enable a sort a versioning scheme on tables. Tables all have version and current fields. On updates, in some situations based on a condition, i ...
0
votes
1answer
23 views

how to circumvent missing record type on insert

I'd like to make a copy of a row in one table addressed by a field in another table, like this: CREATE OR REPLACE FUNCTION f_ins_up_vorb() RETURNS TRIGGER AS $$ DECLARE dienst ...

1 2 3 4 5 19
15 30 50 per page