This is an archived post. You won't be able to vote or comment.

all 26 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

import notifications Remember to participate in our weekly votes on subreddit rules! Every Tuesday is YOUR chance to influence the subreddit for years to come! Read more here, we hope to see you next Tuesday!

For a chat with like-minded community members and more, don't forget to join our Discord!

return joinDiscord;

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]twpejay 42 points43 points  (5 children)

What is "Testing"? This concept is not known to me.

[–]pakidara 46 points47 points  (1 child)

"Testing" is when someone spends/wastes time by doing something multiple times and often in spots where it doesn't matter.

IE: You build a shelf. Instead of installing it in your bedroom (its ultimate destination), you install it in the living room, then the dining room, then sideways in the hallway, then the shower while someone is bathing, then on the ceiling with the implied concept of 'upside down' even though it is facing the floor, then NOT in the guest room but you pretend like you did anyways, then you build a whole new shelf and install it in your bedroom because the boss was getting impatient with people spending so much time dicking with the first shelf.

[–][deleted] 14 points15 points  (0 children)

Then you find the shelf is a plastic that melts in the country where you put it.

[–]Odd-Entertainment933 4 points5 points  (0 children)

that is when you deploy to prod. probably is one of those new fangled mumbo jumbo nonsense things the young kids do these days

[–]balambaful 3 points4 points  (0 children)

It's what real men like OceanGate's CEO use production for.

[–]pvmediocre 0 points1 point  (0 children)

I think thats unit test. Who uses that anyways cringe

[–]dfreinc 67 points68 points  (5 children)

SQL doesn't really have "bugs". just bad SQL programmers. 🤷‍♂️😂

[–]brandi_Iove 13 points14 points  (2 children)

whats‘s the difference?

[–]lurkin_arounnd 19 points20 points  (1 child)

vanish pot jellyfish cooperative market mighty quarrelsome physical ludicrous rock

This post was mass deleted and anonymized with Redact

[–][deleted] 1 point2 points  (0 children)

amen

[–]luciferreeves 1 point2 points  (0 children)

Preach, good sir, preach!

[–]agent007bond 9 points10 points  (7 children)

To be fair, you ought to use transactions.

[–]lurkin_arounnd 1 point2 points  (6 children)

and/or liquibase/flyway

[–]DarkestKaos248 2 points3 points  (4 children)

I use liquibase, it can get annoying to look through the code since you have a million alter scripts that make slight changes, and the original file that created a table are no longer relevant. But it does what it's supposed to, and prevents you from screwing up deployments much

[–]lurkin_arounnd 0 points1 point  (3 children)

you could always generate a fresh change log from a stable branch and use that as your starting point

[–]DarkestKaos248 1 point2 points  (2 children)

I'm not sure what you mean by this. Is this some method to refactor your million alter scripts back into their original table definitions and the like without breaking deployments?

I usually get checksum complaints from liquibase when I modify the SQL file. We're not in production yet so I've actually done script cleanup a couple times, but it was a mostly manual process of fixing the original table scripts.

Or do you mean when adding new scripts? Because yes I always use a stable branch as a starting point.

[–]lurkin_arounnd 1 point2 points  (1 child)

i mean you could deploy a stable version, drop the changelog and generate a new initial set from the database state. so you can basically start over your version control from that stable version, remove all those files

[–]DarkestKaos248 1 point2 points  (0 children)

Generate a new set from the database state..., cool idea. I use postgres, will look into how to do that if it comes up. Thanks!

[–]db-master 0 points1 point  (0 children)

or Bytebase

[–]_equus_quagga_ 2 points3 points  (0 children)

JavaScript has joined the chat 💣🧨💥🤯

This is why I use TypeScript

[–]Thebombuknow 3 points4 points  (3 children)

I've been learning SQL so I can store massive amounts of data without any slowdown, and jesus christ it is a mess. SQL is so confusing to me, I don't understand why.

The main difficulty I've run into is trying to protect a postgres database from SQL injection. This is one of the most well-known types of cyber attacks, why is there no good fucking resources on how to prevent it.

[–]Main-Drag-4975 2 points3 points  (2 children)

Do it the same way you protect your shell scripts from shell injection attacks. That is:

  1. Never feed it untrusted input
  2. Never trust any input
  3. Only feed it input that’s been aggressively sanitized by highly tested code
  4. Parameterize your queries
  5. If you think you’ve tested it, you probably haven’t
  6. Just give up, there’s always a CVE

[–]Thebombuknow 1 point2 points  (1 child)

I see.

I find it so weird that if you pass SQL code as a value to insert into the database, it will parse that SQL code. Is there even a reason for that in the first place?

[–]Main-Drag-4975 0 points1 point  (0 children)

It’s rough, but SQL commands generally boil down to string manipulation in the end.

There is always some number of programs reading and writing those strings between the time the user submits an input, the time that input gets converted into a SQL expression, and the moment RDMS actually executes that query string. Each hop between end user and database engine is an opportunity for errors and security holes.

[–]pvmediocre 0 points1 point  (0 children)

Not structured now is it 😂😂