this post was submitted on 18 Jul 2025
144 points (97.4% liked)

Programming

21831 readers
325 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] msage@programming.dev 3 points 1 week ago (1 children)

I learned that not too long ago, too.

I mean it surprised me, but there are many ways around that. May be less efficient, but you can always use string-to-array, or json, or copy more for CTE then work with inputs as a table.

[–] ragingHungryPanda@lemmy.zip 2 points 1 week ago (1 children)

Create a user defined table type and use that as a parameter. I'm not sure what the postgres name of that is.

[–] msage@programming.dev 1 points 1 week ago (1 children)

And how do you put data into the table?

[–] ragingHungryPanda@lemmy.zip 1 points 1 week ago

Based on old memories since I've been working in mongo lately, after making the UDT on the db side, you make a data table that has the same name, namespace (ie dbo/public), and the same schema as the UDT (better if that could be generated) and populate it in code. Then you execute the db query with the UDT type as a parameter.

This is better for a few reasons, including not building up a string, but also having the same text means that each query didn't need to be re-parsed and can reuse execution plans. If the query text isn't an exact match, it gets that whole pipeline each time.