News for hackers. Stuff that matters.
Re:Ask HN: Have you ever used PL/pgSQL – the PostgreSQL prog... by kennytilton on Sunday September 02, 2018 @09:10PM (#17899585)
I wrote an entire BPM run-time automation in pl/pgsql. The BPs were stored as PG rows, the deciding data was in the PG DB, and PG triggers automated quite a bit, so the firt seemed perfect. The strong static typing was annoying (I am a Lisper) but did have the usual payoff: if it runs at all it is probably right. Debugging over a socket was rough, but I could take the failed query and drop it straight into a pgAdmin query and get back a very clear error. Guy building the BP front-end picked up what I had done in a few days, and he had never done pg/plsql before.

It took a week to code up, another 2-3 for expressing the initial huge BP and a random BP test driver. Worked great.

My only question is whether I would do it again the same way. I liked that there was not some external system that had to be running for the BP to run, but it is not hard to arrange that and then one gets a much more accessible programming environemnt (such as Lisp). I guess I will not know until I get to do it again.

Re:Ask HN: Have you ever used PL/pgSQL – the PostgreSQL prog... by mooreds on Sunday September 02, 2018 @09:32PM (#17899657)
How did you handle deployment and version control?
Re:Ask HN: Have you ever used PL/pgSQL – the PostgreSQL prog... by kennytilton on Sunday September 02, 2018 @10:00PM (#17899769)
I left before the system got much use, so grain of salt and all that. It was a Rails shop so deployment would have been by a migration. Not sure what you mean by version control. The source was in git. Had we refactored significantly we would have had to write a migration. But the system was in the end quite simple. I refer to it as "BPM" but real BPMN is a bloated monstrosity -- I just captured the essence, and that was dead simple. One fun thing I did not mention was implementing "funcall" in pgsql. That meant that edge cases could be covered by writing a custom pgsql function that would do exactly what was needed. That meant the rest of BPM could stay simple.
Re:Ask HN: Have you ever used PL/pgSQL – the PostgreSQL prog... by combatentropy on Sunday September 02, 2018 @11:26PM (#17900105)
Store the command to create the function in a file, and save the file in your version-control system. Make changes to the function only by first changing the file and then running the file through psql.