M
M
Mikhail Mashkantsev2021-06-15 23:11:12
SQL
Mikhail Mashkantsev, 2021-06-15 23:11:12

Error creating trigger..?

Can you see what's wrong with the trigger?

create trigger updater
AFTER INSERT
ON done_cars
for each row
update table2 set table2.counting=table2.counting+1 where table2.workshop_id=new.number;

here is the error:
ERROR: ОШИБКА: ошибка синтаксиса (примерное положение: "update")
LINE 5: update table2 set table2.counting=table2.counting+1 where ta...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-06-16
@galaxy

Of course, it is not necessary to specify the DBMS, they are all the same ...
Apparently, postgres. If so, please read the documentation . Do you see an opportunity to write any DML queries directly in CREATE TRIGGER?
In postgres, all trigger actions are performed through a special function (links to examples in different languages ​​- https://www.postgresql.org/docs/13/triggers.html ) that the trigger should call.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question