missing semicolon at end of psql files

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: missing semicolon at end of psql files
Date: 2012-09-12 14:10:40
Message-ID: 1347459040.16215.5.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I was surprised to find that psql -f file.sql with a file such as this

select 1;
select 2

executes both commands even though the second one is not terminated.

I realize that this is inconsistently handled throughout the system, for
example libpq APIs don't care about the missing semicolon, but
interactive psql does.

But what bothered me about this is that if a file gets truncated by
accident, there could be an unqualified DELETE or something similar at
the end.

Comments?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2012-09-12 14:21:36 git author vs committer
Previous Message Bruce Momjian 2012-09-12 14:09:57 Re: Doc typo: lexems -> lexemes