Postgresql - "ERROR: syntax error at or near "-" when trying to pass a number parameter to a stored procedure

Postgresql - "ERROR: syntax error at or near "-" when trying to pass a number parameter to a stored procedure

我有这个查询:

CREATE TRIGGER notify_user_1
AFTER INSERT OR UPDATE OR DELETE
ON users
FOR EACH ROW
EXECUTE PROCEDURE notify_on_user_location_update(notify_user_1, 1, 43.4765965, -80.5391294, 500);

我得到这个错误:

ERROR:  syntax error at or near "-"
LINE 5: ...ser_location_update(notify_user_1, 1, 43.4765965, -80.539129...

如果我删除“-”,则查询成功。如何成功传递负数?

From the manual

The arguments are literal string constants. Simple names and numeric constants can be written here, too, but they will all be converted to strings

可能自动转换为字符串失败并返回负值,所以您应该使用:

... notify_on_user_location_update('notify_user_1', '1', '43.4765965', '-80.5391294', '500');