« first day (4300 days earlier)      last day (866 days later) » 
01:00 - 16:0016:00 - 23:00

01:50
very spicy vibes in that blog post. could it be due to simply not posting in a while? or something more sinister...?
 
4 hours later…
05:53
I suspect the new intern helped write it
Morning
Oh hai
hmm, can't upload an image to a chat. Have we reached some limit?
confirmed broken
agile chat development perhaps
except, move very slowly and break things
well, I'm gonna retype the image then
I got my first golden badge today, and it's for attendance! Same as in school
damn you, current user!
06:28
they cause most of the issues around here
I tried suspending them, but it did not work
 
1 hour later…
07:43
Every service would run perfectly if it wasn't for those pesky users.
that's why MS bought Citus ;)
Plus, they're just lovely altrusitic people who love to support F/LOSS
08:28
Operating at F/LOSS
08:56
-1
Q: Is there a way to dynamically update records based on values in one column and using that value to find a matching column name?

Dolfandave Id Codes Col_Code1 Col_Code2 Col_Code3 Col_Code4 Col_Code5 A283240 Code1 1 Null Null Null Null B490382 Code2 Null 1 Null Null Null B490382 Code4 Null Null Null 1 Null B449200 Code3 Null Null 1 Null Null C243456 Code4 Null Null Null 1 Null C243456 Code5 Null Null Null Null 1 ...

It's always medical
09:51
A chairde - Morning all!
Medical software companies are always disasters
I’m surprised there aren’t more lawsuits
Maybe I should start suing them
@Zikato Operating at a F/LOSS maybe? I think it's great that they've completely open sourced the "secret sauce" - under the Affero GPL - so that other cloud providers can't swoop (get the vulture metaphor here? :-) ) in and gorge themselves off any of the dev effort. I think more F/LOSS should move to this model to halt AWS, GCP and Azure (and anyone else) from sitting back and shamelessly profiting from the efforts of others without putting anything back into the community!
@Vérace I am not sure I understand your point there
@ypercubeᵀᴹ - I think Redis is a case in point - AIUI, they've struggled recently but (again AIUI) all of the major cloud providers have some sort of Redis offering - but aren't giving back - making the company viable - stuff like that!
10:07
I don't understand what model you are sugegsting that FOSS should move into.
How does this Affero GPL licence differ from GPL? ANd is it more like GPL2 or GPL3?
The Affero GPL means that it can't be hosted by third parties - you are welcome to use the software internally, but you can't turn it into a cloud service!
I think there's an Affero v2 and v3 - AFAIK!
@Vérace I don't think so.
With your eyes closed you can hardly tell the difference
@Vérace I think it means that if you modify the code and offer it anywhere (for money included, in the cloud included), then the users should have access to the modified source code.
so, in essence, it's not really free, from a certain point of view
10:25
Is the GPL free? I don't want to go down that rabbit-hole - what concerns me is cloud giants hosting software and not giving back. I just reread the AGPL - yes, AWS/anyone can host it, but any changes must be made available to the community and not (as I stated earlier) a ban on hosting or placing restrictions on hosting - other than the obligation to make any changes available under the AGPL! Nothing to stop AWS hosting Citus.
However, I believe that many F/LOSS projects are putting clauses that are even more restrictive with a view to closing off "piggy-backing" in any form on software for which the source is available - and I think that's fair enough - if the source is available for me to use, great, that I can't make money off it - that's fine too - and only fair IMHO!
10:40
@Charlieface - in answering this question
0
Q: How to substruct some table rows from another related table rows and get the SUM of the totale result

Abdelraouf dzI have two table (Orders, Payments) they are 1 to many relationships (1:N) One order can have many payments Table 1: Orders id total_price 1 1000 2 2000 3 3000 Table 2: Payments order_id(FK of Orders) amount_payed 1 500 2 2000 3 1000 3 500 3 750 some orders are...

I tried running a performance test. Now, I'm not a SQL Server man, but I "translated" our queries into PostgreSQL and, your query (under PG) appears to get (disastrously) slower and slower as the number of orders increases. I ran these on my home machine with 10,000 orders and 100 payments per order and mine took 158ms and yours took (wait for it...) 05:39.7 (340kms!).
I can't run numbers like this on the fiddle (times out), but if you're game, if you send me some code which will emulate the GENERATE_SERIES(...) part of my code in SQL Server and the relevant INSERTs - I'll run it (groan... install SQL Server...) just to see if it copes better with optimising the code than PostgreSQL... I upvoted your answer anyway because it gave me an insight into LATERAL - something I'm looking at at the minute.
I'm also going to include your LEFT JOIN and COALESCE/ISNULL suggestion - thanks for those! Have to run now - but will update my answer later...
@Vérace what if you add a primary key to the Payment table?
A surrogate one? Why would that help
?
It looks like you’ve got an unindexed foreign key between it and orders?
No, there's foreign key between order-id on both tables!
Right
But does that create an index?
10:44
Sorry - meant index on order_id in payment table!
Order_id in payment table is a foreign key that references order_id in the _order table!
Yes I understand that
Is there any more indexing required? I can't see it!
In SQL Server world, it’s generally considered a good idea to index foreign key columns
3
Creating a foreign key does not create an index implicitly
It is indexed! And it's a good idea in the PostgreSQL world also!
I've explicitly created them in both the PostgreSQL and SQL Server fiddles!
Oh I was looking at your code in the answer
Looking at the perf test results: | |--Table Scan(OBJECT:([fiddle_5aaa5eb140464be8b228c3b4a9d90670].[dbo].[payment])
It seems that payment is a heap (no clustered index) and the nonclustered index isn’t used
That may be the issue there
Change your index to be clustered on payment and try again
10:52
Sorry about the confusion - also, I hadn't indexed that field in my home test - after indexing it runs in ~ 1s = 6x the non-LATERAL query! I should have been warned by the extreme value - but still, I'd like to get to the bottom whether this happens in SQL Server also.
Can you provide the CLUSTERED syntax? Have to run - will be AFK for ~ 3 hrs - I'll get back to this later...
Create clustered index
Strike a pose there’s nothing to it
@Vérace I believe that under GPL2 licence, you are totally free to run the program and modify it. The only restriction is if you distribute the modified program in which case you have to distribute the modified source code too. So there is no restrictions on running the program modified in your machines (or your "cloud" machines) ands sell these services.
11:19
Erik is making friends with the EF team: twitter.com/erikdarlingdata/status/1580275364902760449
7
12:09
Why do they torture databases so
It's starting to look deliberate
But there are unicorns and lightsabers so I guess it's fine
As a DBA those implicit conversions are such a pain to get rid of when the dev team is using any kind of entity framework.
Trying to convince them they are wrong is one of the joys of the job
she said in a sarcastic voice
I had "fun" once with MySQL performance tuning and partial replication over a very narrow bandwidth line. The setup was a combo of mysql and SQL Server and queries were produced by EF.
If EF queries are a torture to SQL Server optimizer, you can imagine what they do to MySQL's one.
@ypercubeᵀᴹ That is exactly my understanding of the GPL2 - and it has led to some cloud vendors "piggy-backing" because there is no restriction on cloud hosting of an app - cloud is not considered distribution under the GPL2 - cloud is considered distribution under the AGPL. I think we agree on this - where I was wrong was that I thought that cloud distribution was flat-out verboten - it is not, but redistribution of source changes (if any) is mandatory! I think we now agree on this also?
@ypercubeᵀᴹ Sounds like a ball of laughs!
15 hours ago, by Zikato
Erik is out there, protecting the SQL against the EF.
12:22
I bought a pair of Cambridge Audio wireless headphones from Amazon a couple of days ago, and now Amazon is recommending I buy every pair by every manufacturer like I need so many of them.
@ErikDarling I would create a clustered index if someone would provide me with the code to do this in SQL Server...
WITH cte1 AS
(
SELECT
o * 100000 AS oid,
p * 100 AS amt
FROM
GENERATE_SERIES(1, 10000) AS o,
GENERATE_SERIES(1, 20) AS p
),
cte2 AS
(
INSERT INTO _order (SELECT DISTINCT oid, 10000000 FROM cte1)
),
cte3 AS
(
INSERT INTO payment (SELECT oid, amt FROM cte1)
RETURNING *
)
SELECT * FROM cte3 LIMIT 5;
without it, I can't simulate a reasonable number of records to do any sort of realistic test!
@Vérace yeah, we agree. GPL3 poses more restrictions than GPL2.
They should have named it differently.
@Vérace CREATE CLUSTERED INDEX pt_order_id_ix ON payment (order_id);
one of the indexes can be clustered. If none is clustered, then the table is a "heap".
> Microsoft announced today that they’re rebranding learn.Microsoft.com to compileAndRun.Microsoft.com because they found that most users don’t want to learn, they just want to get it to compile and run.
Just FTR, by "this" I mean the GENERATE_SERIES code - not how to create a CLUSTERED INDEX!
Communication is a skill
12:34
@JoshDarnell Lol saucy. Erik, send them the Git commit that fixed absolutely nothing with nondeterministic sorting. That'll teach them...
@ypercubeᵀᴹ Thanks - a quick search found that - I was just wondering if there were any added issues - it seems to change the plan! It appears to change the plan for the "ordinary" query also!
@Vérace use 2022. it has generate_series() ;)
Also, was always curious, does the EF team not talk to the SQL Server team about anything they're working on, ever?
They do talk
I'm not certain they listen
@ypercubeᵀᴹ Not available on db<>fiddle!
12:38
Hearing words and listening to them are two distinct things I guess.
I don't mind developers using formated text (xml, json, csv...) at all. I don't even mind them supplying it to, or requesting it from, the database. What I do find offensive is querying (or changing) bits of it inside the database.
Ah so you're not a fan of ORMs eh?
I don't mind them, so long as they store their data in an ODBMS
Or a text file, spreadsheet, whatever
lol
Hey, came across a recent question where the context of the conversation was "Is a spreadsheet a database?".
Sounds like the "what is a database" Q & A
12:43
Again I think ORMs have a place (the developer side in me speaking I guess). Right tool for the right job, but not always the solution. But they do make developer's lives easier more times than not, so a net win in theory.
For the developers only. In the short term.
3
Amen to that
I mean object-relational mapping is a lofty goal. Shame no one has come close to achieving it.
2
Well when they misbehave, consider it extra job security for the DBAs / DB developers. At least it has become a recurring thing for me to work on lol. Win-win-win, in theory.
Seems like Vérace has a challenger for person most likely to be wrong about stuff
12:49
@J.D. I think I'll go around breaking windows - win for the glass makers.
@Zikato as long as you do it legally and safely, win-win-win, in theory.
If you're working on a very small project, with a tight budget and timescale, I dare say coding using an ORM is very attractive. You can always hire Erik to fix some performance issues with your local book club website.
If, on the other hand, you want to create a database useful to more than one data consumer, able to change and scale with updated needs, it's a false economy.
In unrelated news. I'm trying to read the git-diff documentation. A table of contents would be nice. git-scm.com/docs/git-diff
A proper database has an API for the data consumers (views and procedures). The implementation details are no concern of the consumer.
You want to read and write to tables directly? HA HA HA LOL NO
morning
12:57
I actually had a Java dev that was ok with procs. Had.
It has never been difficult to call a procedure or consume its result set(s)
If you want to use a generic mapper tool, fine, map it to the database API
It's just stupid and counterproductive to ask people to do things they're not skilled at
Firing generated ad hoc SQL at a data store is only good news for consultants
@Vérace have a go: dbfiddle.uk/J5K3NmoF
don't break dbfiddle ;)
There are several tiny and free SQL Servers you could install locally
SQL Server Express Edition if you're a database person, LocalDB if you're a develOPer
EF was a mistake
13:07
@PaulWhite true but Verace wanted to check the new goodies available in 2022. I don't see either Developer or Express 2022 available for download.
@ypercubeᵀᴹ It's the same download, you choose the edition at installation time
They advertise it as "Evaluation Edition", but the reality is as I said
Ah, I was checking microsoft.com/en-gb/sql-server/sql-server-downloads Missed the Preview link at the top ;)
7
A: Does MS SQL Server have generate_series function

Hannah VernonA fairly common method of creating a series in T-SQL consists of using a CTE as the source, something like: ;WITH t AS ( SELECT n = v2.n * 10 + v1.n FROM (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) v1(n) CROSS JOIN (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9...

@ypercubeᵀᴹ Microsoft do like to make things as difficult as possible
13:12
2 hours ago, by Erik Darling
In SQL Server world, it’s generally considered a good idea to index foreign key columns
This was another thing EF Core improved over EF6 - they automatically index foreign keys.
@PaulWhite I feel that way on some days. Maybe even a lot of them.
I'm half joking. Something like EF is no doubt of practical use in some cases. People do tend to adopt a tool and then use it for everything, regardless of the specific circumstances.
I am not interested in working on databases created by, and accessed through, EF though.
Those people can hire J.D.
He's good with Windows
@PaulWhite so agreed job security? 🙃
Lol just catching up.
@J.D. If you take me saying it is counterproductive as agreement? There are plenty of things good consultants could be used for. Hacking around terrible dynamic SQL and EF code gen in general is not a good use IMO.
@JoshDarnell Probably a more sensible default, but why does it always have to be an on/off choice? Indexing FKs makes sense sometimes.
I've been working on a project that doesn't use an ORM for a while now. I love how straightforward and predictable it is. I don't love some of the tedium that goes along with it.
Of course, most of my work projects with EF are the opposite. I love that I can read from a table and have the results mapped into C# objects easily. But if I have to write a complicated query, or design relationship between tables that's not one of the obviously supported / implemented ones, then there's a lot of thrashing around and time wasting.
13:22
@Vérace Yes, the obvious thing to do would be either a clustered index over the foreign key (not as silly as it sounds, the PK doesn't need to be clustered) dbfiddle.uk/AUqQ5S_R or INCLUDE columns on a non-clustered index dbfiddle.uk/WkDQhe3Q
2022 has a GENERATE_SERIES learn.microsoft.com/en-us/sql/t-sql/functions/… or you can use one of Itzik's cross-join functions sqlperformance.com/2021/01/t-sql-queries/…
@PaulWhite I don't disagree with most of what you've said so far. But I empathize the developer's perspective too. Databases is not something usually taught or taught well when going to programmer school. And it's definitely a different mindset to solve problems relationally when you've been taught to think iteratively in your schooling.
So in a career dominated (by volume) with developers who weren't properly taught databases, and generally consists of companies who don't spare the time for self learning / growth enough, an ORM is an attractive solution to a problem they don't realize they don't fully understand.
I blame the schools
The lakh of decent database people has always been an issue
It's like rugby in the US, need to fix the grassroots to play the game effectively. 😉
I tend to look at EF as something useful for small databases that are primarily concerned with doing very very basic CRUD. As a rule I usually use Dapper, which means I get to write my own queries, optimize them how I like, and Dapper will map the results automatically.
Note I'm primarily a developer not a DBA
My experience has been that developers work best when they work on code development. Database designers work best when they design databases. Database developers work best when they implement and maintain a design. DBAs check databases for errors and make backups.
All you need is a stable and sensible database API, then everyone can go around automating and tooling whatever they like.
13:28
@PaulWhite True true. Unfortunately there's a lot of companies out there that can't or won't hire full diverse teams of that nature. They leave most hats to be worn by the developers. I guess again kind of a culture thing.
But yes, my company actively encourages self-learning. My boss is happy for me to experiment with anything that will improve my code, and I both develop and manage the apps I create, so I'm holding both ends.
@J.D. No, they're just lazy, short-sighted, and incompetent, like most company staff
@Charlieface What's your preference on using Dapper and writing queries in the application / API layer as opposed to using a full ORM and writing SQL in procedures and views in the database layer?
It's not necessarily a bad thing if developers wear a few hats. They just need to be prepared to learn a lot. Some developers can't be bothered,a nd just stick to what they know.
They invent things like DevOps or whatever to paper over the cracks
13:29
@PaulWhite The managers / company I presume you mean, not the developers?
@J.D. Yes
@Charlieface agreed that's true too
Managers are those who lack any real skills, or have been promoted out of harm's way
There are occasional exceptions to the rule
@J.D. Depends on whether the app is the only thing accessing the DB. If so I tend to stick it all in the app code, unless it's really big and complex. If there are other apps or processes working on the DB then I tend to put stuff in procedures. But I use Dapper either way, I avoid full ORMs like the plague.
Dapper works perfectly well on results from a sproc, and EF can also use them, so the question of which to use is mostly orthogonal to whether to use procedures or not.
Procedures are primarily a way to change a database transactionally. Data comes from views.
13:33
@PaulWhite The question was procs vs batches, not vs views
I wasn't answering anyone's question
Non-sequitur then?
:-)
Following a train of thought
@J.D. Procs do have some benefits over batches re parameter sniffing, temp table caching etc, so I do use them when I see the need. Batches can be kept together with app code, so it's easier to reason about what it's doing. Mix and match basically.
No
Anyway, people will continue to do dumb stuff. That's their problem
13:41
@Charlieface No doubt, interesting perspective. I used Dapper in a previous job but was not a fan. I think it was more so the disorganized implementation of the repository pattern my "team" did (more or less each developer following their own different standards), not really Dapper's fault.
In other news, its fucking snowing
Fake news
@J.D. I guess you need one or two developers to be the ones who are the "SQL experts". That's how we do it, that means we can enforce some standards. Same goes for most other tech: there are one or two experts who can say how it should be done.
@HannahVernon Which corner of the globe? It's bright sunshine here, surprisingly enough.
13:57
@Charlieface Yea no doubt. That's been me everywhere I've worked so far. I'm a developer by trade, self-taught (and still learning :) on the SQL side. Unfortunately I've found that there's even not enough of those guys going around.
PW - nothing stellar that I can see in this release - apart from making (your absolute fave feature! :-) ) regexes more compatible with Oracle - and more sophisticated - it was one area where PostgreSQL was lagging! I'm hoping that by 2025, we'll have a decent storage engine API, Vérace (duly consecrated bishop of PostgreSQL)!
Studying hard for his Ayatollah exams!
@JoshDarnell buncha helmets
Dick thanks you for your tip
@Vérace you literally just put the word “clustered” between “create” and “index” like I said
14:11
@Vérace Not excited about MERGE then
Decent eathquake just now, M5.7 confirmed geonet.org.nz/earthquake/2022p771854
1
Q: Why is my ORDER BY in STRING_AGG not always working?

RebeccaUpdated in response to comments. I have a table that consists of a record ID, a group ID (linking 1 or more records into a group) and a hash value for each record. CREATE TABLE HashTable( RecordID VARCHAR(255), GroupIdentifier VARCHAR(255), Hash VARCHAR (255), GroupHashList VARCHA...

Someone has found a bug in STRING_AGG. Optimizer seems to be compiling a windowed STRING_AGG but forgetting the ORDER BY
@PaulWhite martini time
out of olives
Some may have fallen out of a tree
Fits the facts
14:14
I’m in Amsterdam proper for a couple days but all I can manage to do is stare out my hotel window drinking wine
But olives aren't really heavy enough to cause an earthquake
Oh, I see what you mean now
I should probably figure out dinner before this bottle disappears
@PaulWhite way to go, p-core
Doesn't sound like you're having a tough day
@ErikDarling Yip - done that - seems to change the plan - from a table scan to clustered index seek - can't hurt, but it also changes the plan of the non-LATERAL query - I need a decent amout of records to check it out - I'm on the bus at the moment.
I'm not downloading SQL Server 2022 for Linux Developer Edition on Dublin Bus' wifi! ;-)
@PaulWhite PREEMPTIVE_GREAT_WEEKEND
14:21
@Charlieface approximately 49.8919162, -97.1349876
BREAKING NEWS: ADDING AN INDEX CHANGES THE PLAN
@Vérace right on, yeah. I thought all internet in Europe was double extra light speed plus
Not on Dublin Bus - I can't even get images posted here - not because of speed, they're blocked!
Was it created or added
That’s the real question
Was what created or added?
14:22
Indexes
@Vérace sounds like a personal issue there
@ErikDarling Remind me which country it is that costs $1000+ / month for a T1 line, never mind a proper leased line
I created the table, and the index clustered - see fiddle - ran the SET STATISTICS PROFILE = ON; and then dropped the index and ran the query again - plan changes!
Not sure I understand the "personal issues" bit?
chat image uploads still broken
@Charlieface I'm glad to see adding answers in comments is also a problem at Stack Overflow
Does personal issue mean to imply that I'm looking at images of scantily clad females on the bus? :-)
@ErikDarling Should be drinking Jenever!
14:27
@Charlieface T1? Is this 1998?
It's grim up north
@Vérace well, whatever you prefer. I stopped trying to figure these things out.
Alright, I’m bringing you all with me to a wine bar
What a day for images to stop working
I've tried 3 times already today
24
Q: Image uploading fails with "Failed to upload image; an error occurred on the server"

GlorfindelI can't upload images anymore: on the Ask Question page, the image upload dialog shows a red error message Failed to upload image; an error occurred on the server See the screenshot below (uploaded via imgur's own website): The response from the server is {"Success":false,"Error":5,"ErrorMessage"

We've reproduced this and are investigating the problem. Thanks for reporting it! We'll be back with updates soon. — Catija ♦ 1 hour ago
14:31
I’ll post things to Twitter and link here
Web scale
We've found the problem - it's broken
Great work, team
My wife recently forced me to sign up for Instagram. I am not quite sure if I care enough to learn that platform.
REDDIT WE DID IT
I had to LOL at Erik's response "You again" 🤣😂
14:32
That was a classic
almost made me sign up for Twitter just so I could like it
> Oh, you again 🙄
@HannahVernon almost
I thought it was a well deserved retort
I also thought it was funny that Erik points out the MAX - then they say that's not true and to watch the video, so he points out the video is the same. They agree and then disagree.
14:34
How dare you being rude, when they are only creating more work for you?
> Go on
You should send them a gift basket for the money you'll get fixing their crap
> Perhaps you're thinking of ntext
I liked that one
Wait, is there more?
@SeanGallardy that guy argued with three people about merge (me, Bertrand, Swart) and still came out of it thinking he’s right
14:35
I don't twitter, I'm probably using it wrong
It's impossible to follow threads on Twitter
I think it's by lakh of design
@ErikDarling Classic MS
@PaulWhite Ahem. You mean, no-schema open design for rapid development.
Just JSON it all, baby
Look I’m fine with that just do it somewhere else
Try telling ex-SO developers there are things they don't know about databases
@SeanGallardy one of our main applications is being moved from DB2 to MongoDB because document databases are easier to maintain and leverage for change.
14:40
> Wine and cookies. Adulting in Amsterdam.
I'm glad Erik is in a proper time zone again
@HannahVernon I asked one of the architects about consistency, and they acted like I didn't say anything
(replying to myself lol)
@HannahVernon Boo - unfair - I'm not allowed to reply to my own messages - I actually think that we plebs should be allowed to - for clarifications and the like!
@Vérace its a Tampermonkey script
"Stack Overflow Extras"
@HannahVernon Meaning you have no idea what the schema is basically? The amount of times I get given a REST API spec where the docs don't match what's returned. Or where you run into the "either single object or array problem" and it's entirely undocumented....
14:45
@Charlieface yeah. It's "easy".
:62192088 You can do it manually too
Easier than having to constraint yourself with the tedium of a relational database lol
@Charlieface I"ve always found that the best solution to avoiding this problem is to avoid producing any documentation!
@HannahVernon I'm using Kusto every day now and I absolutely loathe these systems. Hello "tables" with 1000 columns that each dev just does whatever they want with it... such fast development, who needs to think about anything!
@SeanGallardy thought is hard don't you know
14:47
@Zikato I’m working on getting dual citizenship with Portugal
@HannahVernon It wasn't an answer though, it was just a guess. I was responding to Conor by saying it "looks" like a bug. If anyone has any further info they are welcome to write a proper answer....
@HannahVernon 🤔
@Charlieface I hope it gets moved to dba.se
@ErikDarling Apparently in the USA it is, or so I'm told. It's not exactly an advanced western economy....
2 days ago, by Paul White
For the absolute love of small fluffy bunnies, please write answers as answers. Even if you're not sure it's the answer. Use comments for asking for clarifications by all means. Do not attach an answer to such comments. I am pleading with you now.
14:57
@PaulWhite every time you comment-answer, god kills a bunny
🔪🐇
🧖‍♂️☠️🐰
Alright, we’re at a wine bar. Everyone relax.
Act cool. The waitress pretty.
lol @ "act"
Performance expert continues learning about implicit conversions: sqlsunday.com/2022/10/13/…
Maybe next they’ll create or add an index
@HannahVernon mostly talking to Charlie
I just realized that Damien dude didn't even read what you wrote and just decided to write something completely different from left field.
@ErikDarling Go on...
15:05
Of course I’m the one sitting in this chat at a wine bar, maybe I need lessons too
@SeanGallardy having a secret family is very European
@ErikDarling You probably look moody and intense as a result
@PaulWhite Plead all you like, but if it's a blind stab in the dark then it probably shouldn't be an answer. It's basically a "do you think it's this maybe? have you tried this?"
@PaulWhite if I had a sandwich I’d look like a young Tony Soprano
Or in other words "it's not my bunny"
@ErikDarling better than Tony Soprano looks now
too soon?
15:08
@HannahVernon 😂
@Charlieface It's an answer, not a comment.
@Charlieface tell that to the dead bunny’s family
People just don't think, do they
> Comments should only be used for asking for clarification, or to leave constructive criticism that guides the author in improving the post, or to add relevant but minor or transient information to a post (e.g. a link to a related question, or an alert to the author that the question has been updated), or to provide site usage guidance. See the help for details.
I have that in a copy-pasta file for just such occasions lol.
in other words, saying "this might be the cause of your problem" is an answer not a comment
UPDATE HT1
SET GroupHashList = C.HashList
OUTPUT inserted.*
FROM HashTable AS HT1
JOIN
(
    SELECT
        GroupIdentifier,
        HashList =
            STRING_AGG(HT2.[Hash], ';')
                WITHIN GROUP (ORDER BY HT2.[Hash] ASC)
    FROM HashTable AS HT2
    GROUP BY
        HT2.GroupIdentifier
) AS C
    ON C.GroupIdentifier = HT1.GroupIdentifier;
That should help you identify the issue, and it follows Conor's advice
15:11
wow I love OUTPUT clauses so much
@PaulWhite stop talking about me like I’m not here
[Expr1004] = STRING_AGG([dbo].[HashTable].[Hash] as [HT1].[Hash],';')WITHIN GROUP (ORDER BY [HT2].[Hash])
Edited to fit on one line.
I don't see any particular issue with doing a group by apply there, but it ought to get the references right
@PaulWhite Same result dbfiddle.uk/DzArse6r not sure how to identify the issue from that. Conor's point doesn't seem to be relevant: the inner HashTable reference would never be bound as it's a different scope, so that doesn't make a difference.
2 mins ago, by Paul White
[Expr1004] = STRING_AGG([dbo].[HashTable].[Hash] as [HT1].[Hash],';')WITHIN GROUP (ORDER BY [HT2].[Hash])
Man that transcript eh
15:18
Has all the answers
Sorry I must be dense. Is that a bug in the optimizer? Or are you saying it's just a binding problem (user error). Because changing the references makes no difference. CROSS APPLY does seem to make a difference though dbfiddle.uk/GKDcI1me unless you use a GROUP BY () dbfiddle.uk/AZlTrndN
@ypercubeᵀᴹ what do you mean? We do can reply to our own messages. We can even have a message that replies to itself ;)
@PaulWhite @Verace ^^ or a message that replies to the next one
I did that before, but no one noticed
Well, when I go up to a dropdown from my own messages, there's no reply to option!
Is it my imagination or is everyone being giddy like it's Friday?
@PaulWhite I noticed
15:23
@ypercubeᵀᴹ Very good
@Vérace God bless you, Vérace. Never change.
3
The reply-to function is implemented as a :<msg-id> at the start of the line. You can type that yourself if you know, or can predict, the message id
@PaulWhite Like this?
:62192373 nailed it
Goddammit
ha ha ha
15:25
@ErikDarling re-roll
Yeah! Dancing with myself!
@Charlieface Yes, the optimizer transformation to group-by apply has a bug there. It shouldn't reference the table aliased as HT1, only HT2.
Without the different aliases, that's very hard to see
@PW - re. not being excited about MERGE - there was UPSERT which was similar just with different syntax AFAICS... there are a few goodies - as I said, solid but not stellar!
@PaulWhite So you are going to write an answer and resurrect the bunny?
No, because it's Stack Overflow
And I'm just chatting atm not writing Q & A
Well how about we get one more vote for migration?
15:30
That would not be helpful
it's already here
Great job, team
It wasn't off-topic on SO, and the user has no account here
maybe they will once they realize the superior nature of the place
We could have all had a nice time talking about wine and cookies but no
Now we have deal with some migrated orphan shit from SO
orphan shit sounds terribad lol
15:35
That poor user. Commented to death, no answers, question closed & migrated to a place they don't use
Is this DevOps
look at you always thinking about the user
Source of all the problems, I hear
@ErikDarling Not a bad bit of plonk!
Pity we can't drink virtually!
@Vérace similar but not the same. MERGE has much more functionality that INSERT .. ON CONFLICT
@PaulWhite On the other hand, now they'll probably get a much better answer than the usual dross you get on Stack Overflow
15:46
They'll probably never see it
🪦Rebecca🪦
Why wouldn't they see it? There's a huge banner at the top saying it's been migrated, and if you click on the answer from elsewhere it redirects automatically.
@ErikDarling Windows really sucks at keeping their emoji current
Had to switch to phone to see the tombstones
@PaulWhite What rule is this, that transforms it into a window function?
@Charlieface There's a reason I keep referring to it as a group by apply
We've discussed this at length in here before
Sep 2 at 8:30, by Paul White
If so, then the transformation you're after is GenGbApplySimple
15:52
Didn't realize it was the same rule. Headache kicking in, sorry
@Verace We also have the UNIQUE NULLS NOT DISTINCT feature. And "foreign key ON DELETE SET actions to affect only specified columns". And that's it, for SQL language improvements. On the other hand, SQL Server 2022 adds WINDOW clause and IS (NOT) DISTINCT FROM syntax, support for IGNORE / RESPECT NULLS for FIRST/LAST_VALUE() functions, several new aggregate, JSON, bit and general SQL functions (eg GREATEST()) and of course GENERATE_SERIES().
01:00 - 16:0016:00 - 23:00

« first day (4300 days earlier)      last day (866 days later) »