D'Arcy J.M. Cain
2014-07-18 20:22:59 UTC
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?
By the way, "man magic" points to /usr/share/misc/magic which doesn't
actually exist. There is a binary file /usr/share/misc/magic.mgc which
I assume has the data in a format that reads faster but maybe the
source information should be put into the file mentioned by the man
page. If not then I think the man page should be fixed.
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?
By the way, "man magic" points to /usr/share/misc/magic which doesn't
actually exist. There is a binary file /usr/share/misc/magic.mgc which
I assume has the data in a format that reads faster but maybe the
source information should be put into the file mentioned by the man
page. If not then I think the man page should be fixed.
--
D'Arcy J.M. Cain <***@NetBSD.org>
http://www.NetBSD.org/ IM:***@Vex.Net
D'Arcy J.M. Cain <***@NetBSD.org>
http://www.NetBSD.org/ IM:***@Vex.Net