when I am using this command to update table in PostgreSQL 13:
UPDATE rss_sub_source
SET sub_url = SUBSTRING(sub_url, 1, CHAR_LENGTH(sub_url) - 1)
WHERE sub_url LIKE '%/'
limit 10
but shows this error:
SQL Error [42601]: ERROR: syntax error at or near "limit"
Position: 111
why would this error happen and what should I do to fix it?
Best Answer
LIMIT
isn't a valid keyword in anUPDATE
statement according to the official PostgreSQL documentation:Reference: UPDATE (PostgreSQL Documentation )
Solution
Remove
LIMIT 10
from your statement.