debugsqlMinor
PostgreSQL UUID Literal: ERROR: syntax error at or near
Viewed 0 times
postgresqlerrorliteralsyntaxuuidnear
Problem
Whever I use a UUID as a literal, I get
I thought it might be an encoding issue, but that doesn't seem to be it.
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.
Solution
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';Code Snippets
ALTER TABLE newarts ALTER COLUMN jurisdiction_id
SET DEFAULT 'a82857b6-e336-4c6c-8499-4242';Context
StackExchange Database Administrators Q#128431, answer score: 7
Revisions (0)
No revisions yet.