0

I have a Postgres table with a field called user_uuid with type uuid. I also have a valid UUID value that I want to manually insert in that row, but I can't seem to find a way to manually create this.

This is an example of the statement I'm trying to execute:

insert into my_table (account_number, type,  user_uuid) values ('1252', 'residential', 'dOfa6513-aOfd-4e78-9941-724b22804e9f');

I've tried appending ::UUID which I read somewhere might work, and to enclose the UUID text value inside curly brackets, instead of single quotes. None of that has worked, and the docs are not helpful either. The error I get is the following:

 invalid input syntax for type uuid: 'dOfa6513-aOfd-4e78-9941-724b22804e9f'
1
  • 2
    UUID is in hexadecimal, that's base-16, and so uses the values 0-9A-F, and doesn't use the alphabetical character O Commented Dec 10, 2022 at 8:13

2 Answers 2

4

The UUID you're trying to insert is not a valid UUID.

You can check the validity here https://www.freecodeformat.com/validate-uuid-guid.php

This is one example of a valid UUID: a8adfa00-6680-49b3-bf94-caa8c3f1d823, can try pass this into your insert query and check if ok.

Sign up to request clarification or add additional context in comments.

Comments

2

There are 2 occurrences of the letter O in your uuid.
It should have been the digit 0 instead (zero) to make it a proper hexadecimal string: d0fa6513-a0fd-4e78-9941-724b22804e9f

Comments

Your Answer

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.