On Fri, Jul 18, 2014 at 11:32 AM, Adrian Klaver <adrian.klaver@xxxxxxxxxxx> wrote:
On 07/18/2014 08:16 AM, Andrew Pennebaker wrote:Would not doing the below accomplish the same thing for you?
Could we please have the PostgreSQL lexer treat #!... on the first line
of a file as a comment? This would enable .psql scripts to be run with
dot-slash notation preferred by many unix users:
./script.psql
While still allowing the traditional (and Windows compatible) style:
psql -f script.psql
Snip ...
Actually, it wouldn't. Andrew's request is to be able to take advantage of Unix's method of using all text after a #! on the first line of a file to actually mean to execute the program mentioned after the #! and then feed the file to mentioned program. So having a script file like
select * from foo;
modified to
#!/usr/local/pgsql/bin/psql
select * from foo;
would result in a file that could be executed directly on an Unix platform, yet still be capable of being using on a Window's platform using the 'psql -f file' style of execution.
Sounds like a good idea. A more generic approach is to have '#' itself be a comment delimiter. But I suspect doing such would be in conflict with the SQL standard.