Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-3-7-sonnet-20250219-thinking-32k· AnthropicHugging Face LMArena Human Preference 140K

Should the line uuid UUID DEFAULT genrandomuuid(), in INSERT INTO not automagically…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Kimikimi-k2-0711-preview’s answer.
  1. User

    Should the line uuid UUID DEFAULT gen_random_uuid(), in INSERT INTO not automagically generate a UUID for me if the field is NULL?

  2. Claude Assistant

    Yes, that's exactly how DEFAULT constraints should work in PostgreSQL. When you have:

    uuid UUID DEFAULT gen_random_uuid(),
    

    The database should automatically call gen_random_uuid() in two cases:

    1. When the column is omitted from your INSERT statement
    2. When you explicitly insert NULL into that column

    If it's not working as expected, you might check:

    • Are you actually passing NULL and not an empty string?
    • Is the function available in your PostgreSQL version?
    • Does your table definition include this DEFAULT constraint?

    Would you like me to help troubleshoot your specific SQL statement?

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.