Replies: 5 comments 5 replies
-
Hello! Our team built pl/dotnet, and we have lots of input to offer in this space. We also built a cross-PL test suite, which we then completely re-wrote and will release publicly later this year. The goal there was to facilitate more cross-PL cooperation, so I definitely love this idea. |
Beta Was this translation helpful? Give feedback.
-
We're putting the finishing touches on it. Not really sure of the timeline, but it's pretty far along. |
Beta Was this translation helpful? Give feedback.
-
Another thing each PL/ should add is an easy way to add its version of standard This should consist of a single SQL file which creates the functions corresponding to each test and I started adding this directly to |
Beta Was this translation helpful? Give feedback.
-
One long-overdue addition to pl/* language support is supporting streaming functions in a PL, so for example one could have a pl/python function i = 1
while True:
yield i
i += 1 and then use it as SELECT * FROM pyenumerator() LIMIT 5 to get numbers from 1 to 5 This can easily be done for C functions but with current implementation of PL functions which always Materialize the set result the above will result in running out of memory while materializing |
Beta Was this translation helpful? Give feedback.
-
There is current related work in PL/Java, aimed at the existing and (so far) untapped ecosystem of other languages that run on the JVM. Currently unmerged work in progress (you have to build from the branch) asks the question "what should a higher-level version of PostgreSQL's language-handler API look like, so you could write a language handler in Java to implement PL/some JVM language here?" The first example is the language handler for the The handler interface seeks to divvy up the PostgreSQL function-call convention in a way that encourages a staged-programming approach: Naturally, it's up to the handler how sophisticated it wants to be: The specific topic of JVM languages and handlers in Java might not be anybody else's chief interest, but I'm definitely interested in comments on this overall way of approaching a high-level language handler API. The branch will build and allow simple tests of
PL/Java, by the way, does use Java annotations this way (in released versions, even!), which is especially handy given the extra step in PL/Java's usage model: instead of supplying source code directly in Based on the annotations, the Java compiler writes an extra file with the needed SQL commands, to be included in the jar, where PL/Java executes the commands automatically when the jar is loaded. A design decision in the annotation processor is that it doesn't just blindly write out SQL following the annotations, but it knows the same rules PostgreSQL will enforce about which option combinations, for example, are valid. Therefore, you get useful error reporting as soon as you compile the sources, rather than waiting for errors from PostgreSQL when loading the jar. Annotations are provided for defining functions, triggers, UDTs, operators, casts, and aggregates. A nice demonstration is this pull request that compares some substantial example code written by Bear Giles, and demonstrating functions, UDTs, operators, casts, and aggregates, with the same code using the annotations instead of SQL written by hand. In PLs that don't have PL/Java's separate compilation step, any annotations might be used more directly, not by generating a file of SQL commands as PL/Java does. And there might be less value in having them do their own validity checks, as PostgreSQL's own error reports would be immediate. But PL/Java's annotations might serve as one proof of concept. |
Beta Was this translation helpful? Give feedback.
-
Arguably, one of the exciting capabilities of Postgres is the ability to integrate various programming languages with it. And we have some, both in core and outside – but it feels like most of them enjoy limited use 1. It would be great to further grow Postgres' capabilities in improving existing PLs and making it easier to develop new, reliable PLs.
On my end, I have a proof of concept for PL/Prolog, have done some work augmenting plpython's usability and have the desire to get a lot more languages to the mix (to name a few: Ruby, Racket, OCaml 2). Coming out of this angle, I felt that there are at least a couple of things that would be interesting to work on (by no means an exhaustive list):
What do you think about this? Do you have any ideas, insights and knowledge that you can contribute to this cause? What else would be interesting to collaborate on within this space?
I invite those interested in programming languages support in Postgres to participate in this discussion. Also, if you know any PL/* project maintainers, please invite them to this conversation!
1 It's more on the anecdotal/perception side of things – would actually be interesting to give a shot to quantify this statement)
2 The more the merrier, especially if we can figure out good ways to integrate languages with significant runtimes
3 For example, with Python 3, there are significant differences between minor versions. Would supporting multiple runtime versions (when technically feasible) be useful?
4 I've done experimental work on provisioning Python requirements using supplied requirements.txt for omni_python – but I'd like something more generalized.
5 Intuitively, most people want to develop their host language code in their ".py" files, not in SQL files – this is better for tooling, comprehension, etc.
Beta Was this translation helpful? Give feedback.
All reactions