Problem
As it can be seen on https://github.com/PostgREST/plmustache?tab=readme-ov-file#sections, regular syntax highlighting for mustache files doesn't work.
Solution
Add a psql
command that can obtain the function body from another file.
\create_function from ./templates/hello.mustache hello(arg text) returns int LANGUAGE plmustache
I've submitted this on https://www.postgresql.org/message-id/CAGRrpzZnoWY-kK_0qK-OY%3D-e0eDqhc5kdFSkuxN0mxe9iuiz0Q%40mail.gmail.com
It can also be tried on this branch https://github.com/steve-chavez/postgresql/tree/cf with:
$ nix-shell
$ pg-build && with-pg psql
\create_function from ./src/pl/plpython/data/max.py public.max(a int, b int) returns int language plpython3u
select max(3, 4);
Alternatives
- A special syntax highlighter for postgres functions with different langs in VIM? This would have to be done for various editors/IDEs though.
- Another executable besides
psql
that deploys the functions based on mustache files.