Re: pl/pgsql outside the DB, (i.e. on the terminal) possible ? - Mailing list pgsql-general

From Markur Sens
Subject Re: pl/pgsql outside the DB, (i.e. on the terminal) possible ?
Date
Msg-id 27B68073-77D0-443B-9102-078C2D780FC2@gmail.com
Whole thread Raw
In response to pl/pgsql outside the DB, (i.e. on the terminal) possible ?  (Achilleas Mantzios - cloud <a.mantzios@cloud.gatewaynet.com>)
List pgsql-general


On 7 Mar 2024, at 4:56 PM, Achilleas Mantzios - cloud <a.mantzios@cloud.gatewaynet.com> wrote:

Hello

I notice both my kids struggling with either C or Python as first programming languages. I believe both are unsuitable for use as introductory languages to college juniors.

https://scratch.mit.edu/ would be more suitable, maybe ? 


Python IMHO is too advanced, too rich, weird indentation rules, no simple for loop etc.

C, ok, punishing little kids with segmentation faults, calling by value VS by reference and 3ple pointers is pure sadism.

So this brings me to memory good old PASCAL from the time I was junior, circa 1986. PL/SQL resembles PASCAL heavily. Everything seems well defined, strong typing, simplicity, I think it has everything a programming language should have in order to be taught as an introductory language. But it lacks IO and file handling.

So, I ask, have there been any efforts to bring PL/PGSQL to the terminal?

Imho the best you can do is bash + psql + pl/pgsql , via heredocs .
pql <<EOF
<pgsql code.
EOF
It does require lot’s of care with variables  though https://www.depesz.com/2023/05/28/variables-in-psql-how-to-use-them/

But one can get fairly creative. 


Thanks!




pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: pl/pgsql outside the DB, (i.e. on the terminal) possible ?
Next
From: Robert Treat
Date:
Subject: Re: pl/pgsql outside the DB, (i.e. on the terminal) possible ?