Tom Lane wrote: > when we see \if is that we do nothing but absorb text > until we see the matching \endif. At that point we could bitch and throw > everything away if, say, there's \elif after \else, or anything else you > want to regard as a "compile time error". Otherwise we start execution, > and from there on it probably has to behave as we've been discussing. > But this'd be pretty unfriendly from an interactive standpoint, and I'm > not really convinced that it makes for significantly better error > reporting.
This is basically what bash does. In an if/else/fi block in an interactive session, the second prompt is displayed at every new line and nothing gets executed until it recognizes the end of the block and it's valid as a whole. Otherwise, nothing of the block gets executed. That doesn't strike me as unfriendly. When non-interactive, in addition to the block not being executed, the fact that it fails implies that the execution of the current script is ended, independently of the errexit setting. If errexit is set, the interpreter terminates. If it was an included script and errexit is not set, the execution resumes after the point of the inclusion. On the whole, isn't that a reasonable model to follow for psql? Best regards, -- Daniel Vérité PostgreSQL-powered mailer: http://www.manitou-mail.org Twitter: @DanielVerite -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers