"D'Arcy J.M. Cain" <darcy%NetBSD.org@localhost> writes: > There is currently a discussion in the PostgreSQL list about how to get > unix systems to read an SQL script and run it without choking on > invalid statements such as "#! usr/whatever/bin/psql" at the top of the > file. It occurred to me that the old hash-bang thing was a little > restrictive and perhaps it is time to add to the list of magic numbers > that run commands using alternative commenting character. I am > thinking "--!!" for SQL scripts. The ';' character is also common so > perhaps ";!" as well. Those two, with "#!" probably cover 99% of the > possible commenting methods. Would doing this interfere with anything > else? Or should it be PostgreSQL's job to ignore the shebang if it sees > it at the start of its input? Once --!! happens, then there will be requests to add all sorts of things, and this seems like a mess. Surely it's easy enough to teach psql to ignore the first line if it starts with #!, because that's obviously not valid sql. Then it would work everywhere.
Attachment:
pgpcJL9pYJFiy.pgp
Description: PGP signature