Re: [HACKERS] PSQL commands: \quit_if, \quit_unless - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] PSQL commands: \quit_if, \quit_unless
Date
Msg-id 12343.1484371346@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] PSQL commands: \quit_if, \quit_unless  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: [HACKERS] PSQL commands: \quit_if, \quit_unless  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: [HACKERS] PSQL commands: \quit_if, \quit_unless  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Re: [HACKERS] PSQL commands: \quit_if, \quit_unless  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> 2017-01-14 0:20 GMT+01:00 Corey Huinker <corey.huinker@gmail.com>:
>> - leaving loops out for now?

> +1

I'm just going to say one thing about that: some people will remember
that you can build a Turing machine with either conditionals+iteration
or conditionals+recursion.  I wonder what depth of include-file nesting
psql can support, or whether we'll be able to fix it to optimize tail
recursion of an include file.  Because somebody will be asking for that
if this is the toolset you give them.
        regards, tom lane

PS: if I'm being too obscure for you, consider:

$ 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.



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: [HACKERS] how to correctly invalidate a constraint?
Next
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] PSQL commands: \quit_if, \quit_unless