On Sat, Jan 14, 2017 at 12:22 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> $ cat loop.sql
> \if :x < 1000
> \echo :x
> \set x :x + 1
> \include loop.sql
> \fi
> $ psql --set x=0 -f loop.sql
>
> Somebody is going to think of that workaround for not having loops, and
> then whine about how psql runs out of file descriptors and/or stack.
Hmm, I think somebody just DID think of it.
But personally this doesn't upset me a bit. If somebody complains
about that particular thing, I think that would be an excellent time
to suggest that they write a patch to add a looping construct.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company