Feed aggregator
CodeSOD: A Unique Way to Primary Key
"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.
CREATE TYPE record_enum AS ENUM('parts'); CREATE TABLE IF NOT EXISTS parts ( part_uuid VARCHAR(40) NOT NULL, record record_enum NOT NULL, ... ... ... PRIMARY 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.At Least 750 US Hospitals Faced Disruptions During Last Year's CrowdStrike Outage, Study Finds
Read more of this story at Slashdot.
Can AI Think - and Should It? What It Means To Think, From Plato To ChatGPT
Read more of this story at Slashdot.
SoftBank and Open AI's $500 Billion AI Project Struggles To Get Off Ground
Read more of this story at Slashdot.
FCC To Eliminate Gigabit Speed Goal, Scrap Analysis of Broadband Prices
Read more of this story at Slashdot.
Spotify Publishes AI-Generated Songs From Dead Artists Without Permission
Read more of this story at Slashdot.
Alaska Airlines Resumes Operations After System Glitch Grounds All Flights
Read more of this story at Slashdot.
Figma Aims At $16.4 Billion Valuation As Tech IPOs Bounce Back
Read more of this story at Slashdot.
NVIDIA Makes More Hopper, Blackwell Header Files Open-Source
Read more of this story at Slashdot.
Xbox Cloud Games Will Soon Follow You Across Xbox, PC, and Windows Handhelds
Read more of this story at Slashdot.
Weak Password Allowed Hackers To Sink a 158-Year-Old Company
Read more of this story at Slashdot.
Advanced Version of Gemini With Deep Think Officially Achieves Gold-Medal Standard at the International Mathematical Olympiad
Read more of this story at Slashdot.
Former Google CEO Tells Workers: Turn Off Your Phone To Focus
Read more of this story at Slashdot.
Hackers Exploit a Blind Spot By Hiding Malware Inside DNS Records
Read more of this story at Slashdot.
UK Backing Down on Apple Encryption Backdoor After Pressure From US
Read more of this story at Slashdot.
Microsoft To Help France Showcase Paris' Notre-Dame Cathedral in Digital Replica
Read more of this story at Slashdot.
Microsoft Releases Emergency Patches for Actively Exploited SharePoint Zero-Days
Read more of this story at Slashdot.
T-Mobile is Bringing Low-Latency Tech To 5G For the First Time
Read more of this story at Slashdot.
Replit Wiped Production Database, Faked Data to Cover Bugs, SaaStr Founder Says
Read more of this story at Slashdot.
Debian 13.0 To Begin Supporting RISC-V as an Official CPU Architecture
Read more of this story at Slashdot.