Click here to Skip to main content
15,887,422 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: What use are foreign keys anyway? Pin
Jörgen Andersson20-Feb-18 6:05
professionalJörgen Andersson20-Feb-18 6:05 
GeneralRe: What use are foreign keys anyway? Pin
Alister Morton19-Feb-18 4:57
Alister Morton19-Feb-18 4:57 
GeneralRe: What use are foreign keys anyway? Pin
Sander Rossel19-Feb-18 6:56
professionalSander Rossel19-Feb-18 6:56 
GeneralRe: What use are foreign keys anyway? Pin
Out of Memory12-Mar-18 1:20
Out of Memory12-Mar-18 1:20 
GeneralRe: What use are foreign keys anyway? Pin
Sander Rossel12-Mar-18 2:04
professionalSander Rossel12-Mar-18 2:04 
GeneralRe: What use are foreign keys anyway? Pin
S Douglas28-Mar-18 11:13
professionalS Douglas28-Mar-18 11:13 
GeneralRe: What use are foreign keys anyway? PinPopular
CodeWraith13-Feb-18 3:15
CodeWraith13-Feb-18 3:15 
GeneralRe: What use are foreign keys anyway? Pin
RJOberg13-Feb-18 4:26
professionalRJOberg13-Feb-18 4:26 
CodeWraith wrote:
Some dimwit tries to insert or delete something and bounces off these foreign key constraints. Instead of adapting the application logic to take the constraints into account, the harebrain throws the constraints (and the database's integrity) out the window.
First job out of college, I was that dimwit Jr Developer. We needed to delete a few items and add a few new ones. You guessed it, I ran into the constraints.

So I asked the Sr. Dev, he said to drop the keys, add and remove the items, then re-add the keys. Being a good student, I followed his advice. At least I was smart enough to use the automated generate Drop/Add script functionality in SQL so I didn't screw it up THAT much.

Learning through mistakes.
GeneralRe: What use are foreign keys anyway? Pin
CodeWraith13-Feb-18 4:35
CodeWraith13-Feb-18 4:35 
GeneralRe: What use are foreign keys anyway? Pin
Nelek15-Feb-18 2:19
protectorNelek15-Feb-18 2:19 
GeneralRe: What use are foreign keys anyway? Pin
CodeWraith15-Feb-18 2:41
CodeWraith15-Feb-18 2:41 
GeneralRe: What use are foreign keys anyway? Pin
Nelek15-Feb-18 2:45
protectorNelek15-Feb-18 2:45 
GeneralRe: What use are foreign keys anyway? Pin
CodeWraith15-Feb-18 2:51
CodeWraith15-Feb-18 2:51 
GeneralRe: What use are foreign keys anyway? Pin
Nelek15-Feb-18 3:30
protectorNelek15-Feb-18 3:30 
GeneralRe: What use are foreign keys anyway? Pin
CodeWraith15-Feb-18 3:34
CodeWraith15-Feb-18 3:34 
GeneralRe: What use are foreign keys anyway? Pin
jackbrownii29-Mar-18 7:29
professionaljackbrownii29-Mar-18 7:29 
GeneralRe: What use are foreign keys anyway? Pin
Nathan Minier16-Feb-18 1:13
professionalNathan Minier16-Feb-18 1:13 
GeneralRe: What use are foreign keys anyway? Pin
CodeWraith16-Feb-18 2:00
CodeWraith16-Feb-18 2:00 
GeneralRe: What use are foreign keys anyway? Pin
Nathan Minier16-Feb-18 2:08
professionalNathan Minier16-Feb-18 2:08 
GeneralRe: What use are foreign keys anyway? Pin
CodeWraith16-Feb-18 2:43
CodeWraith16-Feb-18 2:43 
GeneralRe: What use are foreign keys anyway? Pin
#realJSOP27-Feb-18 5:46
mve#realJSOP27-Feb-18 5:46 
PraiseRe: What use are foreign keys anyway? Pin
RJOberg28-Feb-18 3:41
professionalRJOberg28-Feb-18 3:41 
GeneralRe: What use are foreign keys anyway? Pin
#realJSOP7-Mar-18 2:07
mve#realJSOP7-Mar-18 2:07 
GeneralRe: What use are foreign keys anyway? Pin
PIEBALDconsult10-Mar-18 16:26
mvePIEBALDconsult10-Mar-18 16:26 
GeneralRe: What use are foreign keys anyway? Pin
Bohdan Stupak5-Mar-18 22:20
professionalBohdan Stupak5-Mar-18 22:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.