Is a sql script interpretable solely by a RDBMS such as PostgreSQL server, or by both the server and a client such as psql? Can the server accept a SQL script file, or only a client can?
My question comes from learning that in psql, \i
can be used to read and execute a sql script. But if a sql script is acceptable by a Postgresql server, how can I provide the script to the server?
When writing a sql script, how can I write a comment? Is #
still used for signaling comment?
Do I need to provide a shebang? If yes, is it a good idea to have a shebang than not?
Thanks.
I am trying to place https://stackoverflow.com/a/771880/156458 into a sql script, so that I can reuse it.