this post was submitted on 19 Nov 2023
1 points (100.0% liked)

Lisp

53 readers
3 users here now

founded 1 year ago
MODERATORS
 

As the title says, I am looking for a library that can connect to Progres and execute a stored procedure with either input or output parameters. Or even a user defined function.

I've checked the documentation of these three libraries:

  • cl-progres
  • pg-dot-lisp
  • clsql

but there seems to be no mention or example of executing a stored procedure. Is it just not documented? Are there other ways I can do it apart from these three?

you are viewing a single comment's thread
view the rest of the comments

Why not just store data and have a procedure which executes with that data as an argument? That's completely equivalent to what you're asking for. I don't imagine there are any libraries that support storing lambda structures in postgres or any other database, because it doesn't make a lot of sense to do so (lambdas could require arbitrary amounts of closure data to be saved, and are very implementation dependent).

It's certainly possible, but you should probably be rethinking exactly what you want to do; one thing you might end up doing is writing a sort of store-procedure function which stores the data necessary for a retrieve-procedure function to create the lambda on demand.

Maybe I'm misunderstanding what you mean by stored procedure and you just want to call a postgres procedure defined with 'create procedure...' . I think you could do that with postmodern and simply the name of the procedure as a keyword, i.e.

> (sql (:my-proc 1 2))
"my_proc(1, 2)"