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

2024-03-07 Thread Adrian Klaver

On 3/7/24 12:20, Achilleas Mantzios wrote:

Στις 7/3/24 21:29, ο/η Adrian Klaver έγραψε:

On 3/7/24 10:13, Achilleas Mantzios wrote:

Στις 7/3/24 18:44, ο/η Robert Treat έγραψε:




I am not talking for fun. I am talking about the future programmers 
of this world. Teaching Python or C to them upon arrival to the 
classes seems so wrong in every aspect.


Seems to me you need to tackle this from the other end, that is what 
are you looking for in a first language?


Something like good ol Pascal, just a little more market-correct to make 
it viable. Something that puts sanity and simplicity above impression or 
anything else. C or Python as first languages (like seems the norm among 
UNIs) is suicidal. I am strongly against it. Kids just dont learn the 
essentials. And the path goes like , simple -> lower lever (C/Assembly) 
, but also higher level (C++/Java/Python/etc). Destroying their minds by 
starting with Python or C just minimizes the chances for future great C 
programmers or Java/Python programmers.


Would that not be covered by a theory of programing course series?

I will admit up front this is getting out of my depth, but from my 
experiences with programming languages they, at a high level, all do the 
same thing basically. Transform text into low level operations on a 
machine. Therefore course work on what those low level operations are 
and the way to abstract above the machine code level would seem to me 
the way to go. Then a series of classes that move languages from lower 
to higher level.




Ppl from the community already expressed to me the shortage of new ppl 
willing to write system level (linux/postgersql) C code. And nothing is 
accidental.






What do UNIs in USA or Europe or Asia teach in 1st semester ?


line isn't strictly one of them.

Robert Treat
https://xzilla.net






--
Adrian Klaver
adrian.kla...@aklaver.com





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

2024-03-07 Thread Achilleas Mantzios

Στις 7/3/24 21:29, ο/η Adrian Klaver έγραψε:

On 3/7/24 10:13, Achilleas Mantzios wrote:

Στις 7/3/24 18:44, ο/η Robert Treat έγραψε:




I am not talking for fun. I am talking about the future programmers 
of this world. Teaching Python or C to them upon arrival to the 
classes seems so wrong in every aspect.


Seems to me you need to tackle this from the other end, that is what 
are you looking for in a first language?


Something like good ol Pascal, just a little more market-correct to make 
it viable. Something that puts sanity and simplicity above impression or 
anything else. C or Python as first languages (like seems the norm among 
UNIs) is suicidal. I am strongly against it. Kids just dont learn the 
essentials. And the path goes like , simple -> lower lever (C/Assembly) 
, but also higher level (C++/Java/Python/etc). Destroying their minds by 
starting with Python or C just minimizes the chances for future great C 
programmers or Java/Python programmers.


Ppl from the community already expressed to me the shortage of new ppl 
willing to write system level (linux/postgersql) C code. And nothing is 
accidental.






What do UNIs in USA or Europe or Asia teach in 1st semester ?


line isn't strictly one of them.

Robert Treat
https://xzilla.net





--
Achilleas Mantzios
 IT DEV - HEAD
 IT DEPT
 Dynacom Tankers Mgmt (as agents only)





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

2024-03-07 Thread Adrian Klaver

On 3/7/24 10:13, Achilleas Mantzios wrote:

Στις 7/3/24 18:44, ο/η Robert Treat έγραψε:




I am not talking for fun. I am talking about the future programmers of 
this world. Teaching Python or C to them upon arrival to the classes 
seems so wrong in every aspect.


Seems to me you need to tackle this from the other end, that is what are 
you looking for in a first language?




What do UNIs in USA or Europe or Asia teach in 1st semester ?


line isn't strictly one of them.

Robert Treat
https://xzilla.net




--
Adrian Klaver
adrian.kla...@aklaver.com





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

2024-03-07 Thread Karsten Hilbert
Am Thu, Mar 07, 2024 at 08:04:21PM +0200 schrieb Achilleas Mantzios:

> > Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> for idx in [0,1,2,3]: print(idx)
>
> Dude this is like saying that for n=N the statement itself takes O(N) to write

You do realize this is a conceptual example ...

> that should be avoided at any cost
> in 1st year of college.

.. which I'd fully expect to be teachable to 1st year of
college folks ?

However, let's refrain from discussing that _here_.

Thanks,
Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B




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

2024-03-07 Thread Achilleas Mantzios

Στις 7/3/24 18:44, ο/η Robert Treat έγραψε:

On Thu, Mar 7, 2024 at 11:26 AM Pavel Stehule  wrote:

čt 7. 3. 2024 v 16:59 odesílatel Christophe Pettus  napsal:

On Mar 7, 2024, at 06:56, Achilleas Mantzios - cloud 
 wrote:
So, I ask, have there been any efforts to bring PL/PGSQL to the terminal?

Strictly speaking, of course, you can use PL/pgSQL from the terminal already: 
just use psql, connect to the database, and create and run functions and 
procedures as much as you like.

If the question is, "Have there been any efforts to implement a PL/pgSQL interpreter 
without PostgreSQL?", that's a different and much more complex problem.  PL/pgSQL 
uses the PostgreSQL query execution machinery to run pretty much anything that is not a 
control structure, and the language is very focused on interacting with the database.  I 
doubt it would be worth anyone's time to try to build some kind of minimal framework that 
implements the SPI to allow PL/pgSQL to operate without PostgreSQL.


yes

plpgsql cannot exist without Postgres. PL/pgSQL is strongly reduced interpreted 
Ada language. The gcc compiler supports Ada language.

I found https://bush.sourceforge.net/bushref.html - it is interpret with Ada 
syntax, but it is better to learn Python - it is easy - with a pretty big 
library.

free pascal https://www.freepascal.org/ is good compiler and you can write 
terminal applications too - with Turbo Vision


Of course there's a certain amount of personal preference with all
this stuff. I started with basic and really liked it, and then had to
learn pascal and hated it so much that I decided to eschew programming
for years. If you are just trying to learn for fun, I see no reason
why SQL, paired with data in a database, wouldn't be worth spending
time on. Once you're comfortable with that, I like ruby on the command
line and it interacts nicely with databases, and also works well
within the rails console. That said, my son liked lua when he was a
kid, so yeah, there's lots of options, even if plpgsql on the command


I am not talking for fun. I am talking about the future programmers of 
this world. Teaching Python or C to them upon arrival to the classes 
seems so wrong in every aspect.


What do UNIs in USA or Europe or Asia teach in 1st semester ?


line isn't strictly one of them.

Robert Treat
https://xzilla.net


--
Achilleas Mantzios
 IT DEV - HEAD
 IT DEPT
 Dynacom Tankers Mgmt (as agents only)





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

2024-03-07 Thread Achilleas Mantzios

Στις 7/3/24 18:25, ο/η Pavel Stehule έγραψε:



čt 7. 3. 2024 v 16:59 odesílatel Christophe Pettus  
napsal:




> On Mar 7, 2024, at 06:56, Achilleas Mantzios - cloud
 wrote:
> So, I ask, have there been any efforts to bring PL/PGSQL to the
terminal?

Strictly speaking, of course, you can use PL/pgSQL from the
terminal already: just use psql, connect to the database, and
create and run functions and procedures as much as you like.

If the question is, "Have there been any efforts to implement a
PL/pgSQL interpreter without PostgreSQL?", that's a different and
much more complex problem.  PL/pgSQL uses the PostgreSQL query
execution machinery to run pretty much anything that is not a
control structure, and the language is very focused on interacting
with the database. I doubt it would be worth anyone's time to try
to build some kind of minimal framework that implements the SPI to
allow PL/pgSQL to operate without PostgreSQL.


yes

plpgsql cannot exist without Postgres. PL/pgSQL is strongly reduced 
interpreted Ada language. The gcc compiler supports Ada language.


I found https://bush.sourceforge.net/bushref.html - it is interpret 
with Ada syntax, but it is better to learn Python - it is easy - with 
a pretty big library.

Cool, thank you.


free pascal https://www.freepascal.org/ is good compiler and you can 
write terminal applications too - with Turbo Vision

Too bad, PASCAL is now neglected by most UNIs :(


Regards

Pavel


--
Achilleas Mantzios
 IT DEV - HEAD
 IT DEPT
 Dynacom Tankers Mgmt (as agents only)


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

2024-03-07 Thread Achilleas Mantzios

Στις 7/3/24 17:13, ο/η Karsten Hilbert έγραψε:

Am Thu, Mar 07, 2024 at 04:56:18PM +0200 schrieb Achilleas Mantzios - cloud:


Python IMHO is too advanced, too rich,

Python _is_ powerful but it needn't be difficult.


weird indentation rules

A matter of taste IMO.


no simple for loop

Really ?

Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> for idx in [0,1,2,3]: print(idx)



Dude this is like saying that for n=N the statement itself takes O(N) to 
write, this is not only "not-simple", this is a darn anti-pattern , that 
should be avoided at any cost in 1st year of college.




...
0
1
2
3
>>>

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B



--
Achilleas Mantzios
 IT DEV - HEAD
 IT DEPT
 Dynacom Tankers Mgmt (as agents only)





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

2024-03-07 Thread Robert Treat
On Thu, Mar 7, 2024 at 11:26 AM Pavel Stehule  wrote:
> čt 7. 3. 2024 v 16:59 odesílatel Christophe Pettus  napsal:
>> > On Mar 7, 2024, at 06:56, Achilleas Mantzios - cloud 
>> >  wrote:
>> > So, I ask, have there been any efforts to bring PL/PGSQL to the terminal?
>>
>> Strictly speaking, of course, you can use PL/pgSQL from the terminal 
>> already: just use psql, connect to the database, and create and run 
>> functions and procedures as much as you like.
>>
>> If the question is, "Have there been any efforts to implement a PL/pgSQL 
>> interpreter without PostgreSQL?", that's a different and much more complex 
>> problem.  PL/pgSQL uses the PostgreSQL query execution machinery to run 
>> pretty much anything that is not a control structure, and the language is 
>> very focused on interacting with the database.  I doubt it would be worth 
>> anyone's time to try to build some kind of minimal framework that implements 
>> the SPI to allow PL/pgSQL to operate without PostgreSQL.
>
>
> yes
>
> plpgsql cannot exist without Postgres. PL/pgSQL is strongly reduced 
> interpreted Ada language. The gcc compiler supports Ada language.
>
> I found https://bush.sourceforge.net/bushref.html - it is interpret with Ada 
> syntax, but it is better to learn Python - it is easy - with a pretty big 
> library.
>
> free pascal https://www.freepascal.org/ is good compiler and you can write 
> terminal applications too - with Turbo Vision
>

Of course there's a certain amount of personal preference with all
this stuff. I started with basic and really liked it, and then had to
learn pascal and hated it so much that I decided to eschew programming
for years. If you are just trying to learn for fun, I see no reason
why SQL, paired with data in a database, wouldn't be worth spending
time on. Once you're comfortable with that, I like ruby on the command
line and it interacts nicely with databases, and also works well
within the rails console. That said, my son liked lua when he was a
kid, so yeah, there's lots of options, even if plpgsql on the command
line isn't strictly one of them.

Robert Treat
https://xzilla.net




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

2024-03-07 Thread Markur Sens


> On 7 Mar 2024, at 4:56 PM, Achilleas Mantzios - cloud 
>  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  
> Thanks!
> 
> 
> 



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

2024-03-07 Thread Adrian Klaver

On 3/7/24 06:56, Achilleas Mantzios - cloud 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.


What the cool kids are using:)?

https://www.rust-lang.org/

https://doc.rust-lang.org/rust-by-example/

This old non-professional programmer could see learning this, so young 
minds should be able to grasp it.




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?

Thanks!





--
Adrian Klaver
adrian.kla...@aklaver.com





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

2024-03-07 Thread Pavel Stehule
čt 7. 3. 2024 v 16:59 odesílatel Christophe Pettus 
napsal:

>
>
> > On Mar 7, 2024, at 06:56, Achilleas Mantzios - cloud <
> a.mantz...@cloud.gatewaynet.com> wrote:
> > So, I ask, have there been any efforts to bring PL/PGSQL to the terminal?
>
> Strictly speaking, of course, you can use PL/pgSQL from the terminal
> already: just use psql, connect to the database, and create and run
> functions and procedures as much as you like.
>
> If the question is, "Have there been any efforts to implement a PL/pgSQL
> interpreter without PostgreSQL?", that's a different and much more complex
> problem.  PL/pgSQL uses the PostgreSQL query execution machinery to run
> pretty much anything that is not a control structure, and the language is
> very focused on interacting with the database.  I doubt it would be worth
> anyone's time to try to build some kind of minimal framework that
> implements the SPI to allow PL/pgSQL to operate without PostgreSQL.
>

yes

plpgsql cannot exist without Postgres. PL/pgSQL is strongly reduced
interpreted Ada language. The gcc compiler supports Ada language.

I found https://bush.sourceforge.net/bushref.html - it is interpret with
Ada syntax, but it is better to learn Python - it is easy - with a pretty
big library.

free pascal https://www.freepascal.org/ is good compiler and you can write
terminal applications too - with Turbo Vision

Regards

Pavel


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

2024-03-07 Thread Christophe Pettus



> On Mar 7, 2024, at 06:56, Achilleas Mantzios - cloud 
>  wrote:
> So, I ask, have there been any efforts to bring PL/PGSQL to the terminal?

Strictly speaking, of course, you can use PL/pgSQL from the terminal already: 
just use psql, connect to the database, and create and run functions and 
procedures as much as you like.

If the question is, "Have there been any efforts to implement a PL/pgSQL 
interpreter without PostgreSQL?", that's a different and much more complex 
problem.  PL/pgSQL uses the PostgreSQL query execution machinery to run pretty 
much anything that is not a control structure, and the language is very focused 
on interacting with the database.  I doubt it would be worth anyone's time to 
try to build some kind of minimal framework that implements the SPI to allow 
PL/pgSQL to operate without PostgreSQL.





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

2024-03-07 Thread Karsten Hilbert
Am Thu, Mar 07, 2024 at 04:56:18PM +0200 schrieb Achilleas Mantzios - cloud:

> Python IMHO is too advanced, too rich,

Python _is_ powerful but it needn't be difficult.

> weird indentation rules

A matter of taste IMO.

> no simple for loop

Really ?

Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> for idx in [0,1,2,3]: print(idx)
...
0
1
2
3
>>>

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B




pl/pgsql outside the DB, (i.e. on the terminal) possible ?

2024-03-07 Thread Achilleas Mantzios - cloud

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.


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?

Thanks!