Using this SQL:
DROP FUNCTION IF EXISTS notify_new_proposed_game();
CREATE FUNCTION notify_new_proposed_game()
RETURNS void
AS 'NOTIFY proposed_game, ''new'';'
LANGUAGE SQL;
DROP TRIGGER IF EXISTS new_proposed_game ON game;
CREATE TRIGGER new_proposed_game
AFTER INSERT
ON game
EXECUTE FUNCTION notify_new_proposed_game();
I get this error:
DROP FUNCTION
CREATE FUNCTION
psql:schema.sql:27: NOTICE: trigger "new_proposed_game" for relation "game" does not exist, skipping
DROP TRIGGER
psql:schema.sql:31: ERROR: syntax error at or near "FUNCTION"
LINE 4: EXECUTE FUNCTION notify_new_proposed_game();
and I'm not sure why.
I'm between novice and intermediate with SQL, so it could well be something really simple.
The function works when called manually in PSQL.
Desired result:
- no error
- trigger is set up