$ cat loop.sql
\if :x < 1000
 \echo :x
 \set x :x + 1
 \include loop.sql
\fi
$ psql --set x=0 -f loop.sql


Nice one! CPP does not have arithmetic, so it is harder to do that because one must reimplement arithmetic with #if...

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.

One can already have "include nested too deeply" errors, I guess, without a recursion.

I would say that's this consequence is acceptable, and that this is a feature.

I think having some kind of client-side test brings significant value because it would help writing application schema upgrades for instance, and that the this potential whining source is worth handling.

--
Fabien.


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to