3

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.

Evan Carroll
65.7k50 gold badges259 silver badges510 bronze badges
asked Feb 5, 2016 at 18:49
0

1 Answer 1

7

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';
answered Feb 5, 2016 at 18:58
1
  • 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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.