hall_of_famer — 2013-09-15T15:13:10-04:00 — #1
Well I am trying to create a trigger, but it seems that using PGMyadmin's SQL command prompt wont work, it shows syntax error all the time:
CREATE TRIGGER trigger_name BEFORE INSERT ON table_name
FOR EACH ROW
// Code inside
Anyone knows how to fix this problem? I have absolutely no idea why this syntax error appears:
ERROR: syntax error at or near "BEGIN"
LINE 3: BEGIN
r937 — 2013-09-16T07:37:55-04:00 — #2
i would start by looking up the CREATE TRIGGER syntax in da manual --
hall_of_famer — 2013-09-16T08:02:41-04:00 — #3
Yeah I made sure to check the syntax and found nothing wrong with it.
cpradio — 2013-09-16T08:54:40-04:00 — #4
From the manual, it seems a TRIGGER can ONLY execute a function in PostgresSQL
CREATE TRIGGER creates a new trigger. The trigger will be associated with the specified table and will execute the specified function funcname when certain events occur.
hall_of_famer — 2013-09-16T09:02:06-04:00 — #5
Well the Manual says that its possible to use FOR EACH ROW statement, weird.
cpradio — 2013-09-16T09:07:14-04:00 — #6
Yes, but following that must be EXECUTE funcname (arguments) not BEGIN
system — 2014-10-08T00:51:57-04:00 — #7
This topic is now closed. New replies are no longer allowed.