this ended up being much faster than googling could have been for context, I typically don't write in pl/plpgsql and was struggling with a particular syntax issue. upon erquest, ChatGPT wrote a valid function and even came up with a function name that I think I'll keep