- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Edit Admin
What is "WITH UR" even supposed to do? What SQL dialect is this? I'm genuinely curious.
Admin
DB2 Uncommitted Read Allows it to read without locking the table.
Edit Admin
Maybe it produces output in Assyrian?
Edit Admin
Ironically using SQL COUNT itself is often a code smell. Yes, in the past it was required for pagination previews (which always was an unreliable estimate anyway) but UX has evolved since then and endless scrollers eliminated the need for it. Sure, there are use cases where you have to aggregate data in a certain way, but those are highly limited. So seeing this method I wonder if there are bigger architectural issues at play in general.
Edit Admin
Isolation level, uncommitted read. I think it's an IBM thing, I vaguely remember it seeing it working for a client using DB2 but that was ages ago, don't take my word for it.
Admin
Which is worse - programming by Google, Stack Overflow or ChatGPT?
Admin
Either ChatGPT or TDWTF, it's close.
Admin
Highly limited? I think you severely misunderestimate the diversity of programming jobs. My code base has a quite a few SELECT COUNT instances, and only a few of them are for pagination (which, BTW, I as a user still prefer to endless scrolling, mostly, well, because you don't have to scroll endlessly ...)
Edit Admin
Stack Overflow often has great answers (at least for .net) but it's often not the most upvoted one; always check out the second answer as well. Obviously .net evolves greatly so a 5 year old answer might be completely wrong, so it's important to consider the date as well.
However that should be a starting point, the answers are the now where the research starts if they hold up ground. A web search engine is useful in that regard but be prepared to encounter a lot of garbage.
Finally ChatGPT is completely useless if you are not already an expert in the topic anyway. It confidently recommends anti-patterns, not thread-safe code (race conditions) and outdated solutions with known security vulnerabilities. So for experts it's pointless to use beyond having fun with a silly toy and for non-experts it can be outright dangerous.
Admin
A truly 'gifted' programmer will use all three!
Edit Admin
Babylonian laughs at your Assyrian syntax! The code of Hammurabi is clearly superior.
Edit Admin
Get thee behind me endless scrolling.
Endless scrolling is horrible for anything except smallish result sets. I suggest we all move to pagination to eliminate the need for endless scrolling.
Edit Admin
you forgot the rest of the sentence: "... to know definitively what NOT to do."
Admin
Oracle also has a WITH clause for subquery's: https://oracle-base.com/articles/misc/with-clause.
Edit Admin
For anyone interested in the UX considerations around endless scrolling, check out this summary from the Nielsen Norman Group: https://www.nngroup.com/articles/infinite-scrolling-tips/
Admin
"However that should be a starting point, the answers are the now where the research starts if they hold up ground."
I am reminded of my English teachers who said, "write it in your own words." I wish more people took things like Stack Overflow as a learning opportunity and not a coding familiar.
Admin
By the way, what is count?? It is incremenred at each reply row nut I do not see it declared or initialized. Perhaps, it is a global variable counting all reply rows received throughout the run?
Admin
"What is "WITH UR" even supposed to do? What SQL dialect is this? I'm genuinely curious."
It's short for "WITH UR MOM".
Admin
Me reading stack overflow: "Didn't anyone bother to read this person's question? Spew based on keywords isn't an answer."
Me with ChatGPT:
ChatGPT: Here is a totally bogus solution to your question that looks like it might work.
Me: That's wrong and will throw an exception.
ChatGPT: I'm sorry about that. Here's an alleged correction.
Me: You're pretty worthless.
ChatGPT: I humbly apologize and offer yet another bad solution as penance.
Edit Admin
Yeah, well the problems with any LLM trained using code that's freely available on the Internet are encapsulated neatly in Sturgeon's Revelation: "ninety-percent of everything is crud".
And in context, the particular slice of "everything" that's interesting is "software". Not just "code that's freely available on the Internet", but all of it. So we train the LLM on code that's 90% crud, and we expect the LLM to somehow generate actual good code...
Admin
"The query contains a WITH clause, but it's in the wrong spot". If it's DB2 SQL (which it looks like) then it's in the right spot
Admin
"Easy Reader Version: If you don't understand the code, don't commit it"
I initially read that as "... don't vomit it", which somehow seems even more appropriate.
Edit Admin
I'm with you, can't stand this endless scrolling nonsense.
Give me good ol' pagination any day of the week.