this post was submitted on 10 May 2026
298 points (99.0% liked)

Programmer Humor

31399 readers
1002 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] TootSweet@lemmy.world 60 points 4 days ago (2 children)
create table boolean (
  id integer primary key,
  name text not null unique
)
insert into boolean (name) values ('true');
insert into boolean (name) values ('false');
create table document (
  id integer primary key,
  name text not null unique,
  body text not null,
  is_archived not null integer,
  foreign key (is_archived) references boolean (id)
    on delete cascade
    on update no action
);

Solved.

Bonus: DBAs hate this one weird trick that can free up incredible amounts of disk space by deleting just two rows.

[–] folekaule@lemmy.world 43 points 4 days ago

That on delete cascade is evil. I love it.

[–] Baizey@feddit.dk 21 points 4 days ago (1 children)

Would this make 0 = true and 1 = false?

[–] TootSweet@lemmy.world 31 points 4 days ago (1 children)

You're right, that's way too simple. Definitely need to rotate the booleans daily. For... security. Yeah, security.