I have a PostgreSQL table, and there's a user_id column which data type is uuid.
Given that uuid, I want to update a expired_at column which datatype is timestampz.
I tried a few queries, like:
UPDATE public.session SET expired_at = '2025-06-18 15:41:30.489 +00:00' WHERE user_id::text = "32e9b5cb-d033-4c57-a4b9-dcca911e013";
UPDATE public.session SET expired_at = '2025-06-18 15:41:30.489 +00:00' WHERE user_id = cast('32e9b5cb-d033-4c57-a4b9-dcca911e013') as uuid;
UPDATE public.session SET expired_at = '2025-06-18 15:41:30.489 +00:00' WHERE user_id = '32e9b5cb-d033-4c57-a4b9-dcca911e013'::uuid;
Nothing works. Postgres will complain something like:
SQL Error [22P02]: ERROR: invalid input syntax for type uuid: "32e9b5cb-d033-4c57-a4b9-dcca911e013"
Position: 89
Error position: line: 1 pos: 88
What's the correct syntax?
pg_input_is_valid(). In earlier versions, you can define your own.