Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      This week in AI updates: Mistral’s new Le Chat features, ChatGPT updates, and more (September 5, 2025)

      September 6, 2025

      Designing For TV: Principles, Patterns And Practical Guidance (Part 2)

      September 5, 2025

      Neo4j introduces new graph architecture that allows operational and analytics workloads to be run together

      September 5, 2025

      Beyond the benchmarks: Understanding the coding personalities of different LLMs

      September 5, 2025

      Hitachi Energy Pledges $1B to Strengthen US Grid, Build Largest Transformer Plant in Virginia

      September 5, 2025

      How to debug a web app with Playwright MCP and GitHub Copilot

      September 5, 2025

      Between Strategy and Story: Thierry Chopain’s Creative Path

      September 5, 2025

      What You Need to Know About CSS Color Interpolation

      September 5, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Why browsers throttle JavaScript timers (and what to do about it)

      September 6, 2025
      Recent

      Why browsers throttle JavaScript timers (and what to do about it)

      September 6, 2025

      How to create Google Gemini AI component in Total.js Flow

      September 6, 2025

      Drupal 11’s AI Features: What They Actually Mean for Your Team

      September 5, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Harnessing GitOps on Linux for Seamless, Git-First Infrastructure Management

      September 6, 2025
      Recent

      Harnessing GitOps on Linux for Seamless, Git-First Infrastructure Management

      September 6, 2025

      How DevOps Teams Are Redefining Reliability with NixOS and OSTree-Powered Linux

      September 5, 2025

      Distribution Release: Linux Mint 22.2

      September 4, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: A Unique Way to Primary Key

    CodeSOD: A Unique Way to Primary Key

    July 22, 2025

    “This keeps giving me a primary key violation!” complained one of Nancy‘s co-workers. “Screw it, I’m dropping the primary key constraint!”

    That was a terrifying thing to hear someone say out loud. Nancy decided to take a look at the table before anyone did anything they’d regret.

    <span class="hljs-keyword">CREATE</span> TYPE record_enum <span class="hljs-keyword">AS</span> ENUM(<span class="hljs-string">'parts'</span>);
    <span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> IF <span class="hljs-keyword">NOT</span> <span class="hljs-keyword">EXISTS</span> parts (
        part_uuid <span class="hljs-type">VARCHAR</span>(<span class="hljs-number">40</span>) <span class="hljs-keyword">NOT</span> <span class="hljs-keyword">NULL</span>,
        record record_enum <span class="hljs-keyword">NOT</span> <span class="hljs-keyword">NULL</span>,
        ...
        ...
        ...
        <span class="hljs-keyword">PRIMARY</span> KEY (part_uuid, record)
    );
    

    This table has a composite primary key. The first is a UUID, and the second is an enum with only one option in it- the name of the table. The latter column seems, well, useless, and certainly isn’t going to make the primary key any more unique. But the UUID column should be unique. Universally unique, even.

    Nancy writes:

    Was the UUID not unique enough, or perhaps it was too unique?! They weren’t able to explain why they had designed the table this way.

    Nor were they able to explain why they kept violating the primary key constraint. It kept happening to them, for some reason until eventually it stopped happening, also for some reason.

    [Advertisement]
    Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleRuboCop – Ruby static code analyzer and formatter
    Next Article La Disputa su putty.org: Tra Software Open Source e Interessi Commerciali

    Related Posts

    News & Updates

    Hitachi Energy Pledges $1B to Strengthen US Grid, Build Largest Transformer Plant in Virginia

    September 5, 2025
    News & Updates

    How to debug a web app with Playwright MCP and GitHub Copilot

    September 5, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    CVE-2025-47227 – Netmake ScriptCase Authentication Bypass

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-8334 – Campcodes Online Recruitment Management System SQL Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-40624 – TCMAN’s GIM SQL Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Supply-chain dependencies: Check your resilience blind spot

    Development

    Highlights

    News & Updates

    Intel could be prepping a new mid-range GPU, giving gamers another reason to skip NVIDIA’s RTX 5060

    May 15, 2025

    Intel’s social media team has been teasing us with Arc B770 hints lately, which is…

    Best AI Girlfriend Simulator [2025 Working Apps and Websites]

    August 25, 2025

    CVE-2025-5316 – “Apache Log4j Remote Code Execution Vulnerability”

    July 5, 2025

    How to Fine-Tune Large Language Models

    September 5, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.