Quantcast
Channel: Planet PostgreSQL
Viewing all articles
Browse latest Browse all 9968

Leo Hsu and Regina Obe: The wonders of Any Element

$
0
0

PostgreSQL has this interesting placeholder called anyelement which it has had for a long time and its complement anyarray. They are used when you want to define a function that can handle many types arguments or can output many types of outputs. They are particularly useful for defining aggregates, which we demonstrated in Who's on First and Who's on Last and several other aggregate articles.

Anyelement / anyarray can be used just as conveniently in other functions. The main gotcha is that when you pass in the first anyelement/anyarray all subsequent anyelement / anyarray must match the same data type as the first anyelement / anyarray.


Continue reading "The wonders of Any Element"

Viewing all articles
Browse latest Browse all 9968

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>