News for hackers. Stuff that matters.
Re:Unnatural Keys – Nature doesn’t come with identifiers by dale_glass on Sunday May 28, 2023 @04:18AM (#36102145)
Yeah, but you don't want to use that as a primary key for your stock database.

It'll work fine until you find you want to keep track of U-235 and U-238 separately.

What constitutes identity is context-dependent. Yeah, on one level they're the same thing. On another they aren't.

Re:Unnatural Keys – Nature doesn’t come with identifiers by rzzzt on Sunday May 28, 2023 @05:54AM (#36102615)
Make it a composite key of atomic and mass numbers, then.
Re:Unnatural Keys – Nature doesn’t come with identifiers by xmcqdpt2 on Sunday May 28, 2023 @06:34AM (#36102846)
But then you need to have a stored procedure to maintain integrity every time an atom undergoes radioactive decay, that's got to be bad for performance!
Re:Unnatural Keys – Nature doesn’t come with identifiers by c00lio on Sunday May 28, 2023 @06:34AM (#36102847)
But then you'd miss on crystal structure to distinguish your diamonds from your coal.
Re:Unnatural Keys – Nature doesn’t come with identifiers by OJFord on Sunday May 28, 2023 @11:38AM (#36104988)
Which single element are they then?

Surely such a system would have a products table with something like nominal element fk, purity, mass columns anyway. (And stock table with fk to products.)

Then nothing wrong with 'natural' key on the elements, but sure, products are the thing you've (personally) made up, so of course there's no 'someone else's' key to use.

Re:Unnatural Keys – Nature doesn’t come with identifiers by TRiG_Ireland on Sunday May 28, 2023 @04:10PM (#36107308)
Diamonds and coal are both pure carbon (mostly carbon-12). So is graphite, and buckminsterfullerene, and a number of other things. Crystal structure matters a lot.
Re:Unnatural Keys – Nature doesn’t come with identifiers by OJFord on Sunday May 28, 2023 @04:48PM (#36107649)
They're not pure carbon was my point. I wasn't saying crystal structure not important, I missed that but it'd be in my 'product derived from element x' table.
Re:Unnatural Keys – Nature doesn’t come with identifiers by alexvoda on Wednesday May 31, 2023 @04:10AM (#36135775)
Actually, in that case that would not be a properly normalized key because the mass number (counts both protons and neutrons) depends on the atomic number(protons).

Also it gets fun if you want to store anti-particles too.