Tag: plpgsql
WITH HOLD cursors and transactions in PostgreSQL
© Laurenz Albe 2021 Both cursors and transactions are basic ingredients for developing a database application. This article describes how cursors and transactions interact and how WITH HOLD can work around their limitations. We will also see the dangers involved and how to properly use WITH HOLD cursors in a PL/pgSQL procedure. Cursors in PostgreSQL […]
Implementing Autonomous Transactions in Postgres
BY Kaarel Moppel – Having recently witnessed quite an ingenious hack to implement some good old “println” style development debugging from stored procedures into a file, it prompted me to post knowledge to the Interwebs on two other ways how such a goal can be implemented more transparently. Also, with help of some other good […]
Choose plpgsql variable names wisely
Pavel Stehule recently wrote the post “Don’t use SQL keywords as PLpgSQL variable names” describing the situation when internal stored routine variable names match PostgreSQL keywords. But the problem is not only in keywords but also for plpgsql variable names. Consider: Output: OK, at least we have no hidden error like in Pavel’s case. Let’s […]