Whever I use a UUID as a literal, I get

SELECT a82857b6-e336-4c6c-8499;
ERROR:  syntax error at or near "-"

I thought it might be an encoding issue, but that doesn't seem to be it.


1 Answer 1


As documented in the manual, string constants (or in general: anything that is not a number) need to be enclosed in single quotes:

ALTER TABLE newarts ALTER COLUMN jurisdiction_id 
   SET DEFAULT 'a82857b6-e336-4c6c-8499-4242';
  • OF COURSE! But that's why sometimes I need another pair of eyes. It is more like a string than an integer. I just didn't see / think of it. Thanks. Commented Feb 5, 2016 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.