Stephen Frost <sfrost@xxxxxxxxxxx> writes: > Greetings, > * John McKown (john.archie.mckown@xxxxxxxxx) wrote: >> Again, this is just a discussion point. And I'm quite willing to admit >> defeat if most people don't think that it is worth the effort. > For my 2c, at least, I do think it'd be kind of neat to have, but we'd > need a fool-proof way to realize that's how we're being called and, > ideally, that would be something we could detect without having to have > special flags for psql which anyone writing such a script would have to > be aware of. > Do you know if there's a way to detect that we're being called this > way..? Actually, I'd say that's exactly what *not* to do. It's generally important that a script act the same whether or not it was invoked with a shortcut. For instance, just because you had one of these magic lines at the top, you'd not want it to not work if called via \include. So my take on it is that this is a request to ignore the first line if it starts with "#!" (and yes, I'd insist on checking both characters). I do not see that as noticeably more dangerous than the existing kluge to ignore a UTF BOM character at the start of the file. The concerns about whether psql would get invoked with a desirable set of options if you tried to do this seem more worrisome, but if that does work out usefully, I think this is a reasonable proposal. regards, tom lane