BeardMagician
BeardMagician

Reputation: 657

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

I have this query:

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);

And I get this error:

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

If I remove the '-' the query is successful. How do I successfully pass a negative number?

Upvotes: 0

Views: 1741

Answers (1)

user330315
user330315

Reputation:

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

Maybe the automatic conversion to strings fail with a negative value, so you should use:

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

Upvotes: 3

Related Questions