My understanding is, if you have system calls from within
postgres, the child processes invoked are run in the
postgres user's environment.
So, login as user postgres and have a look what aliases
are set. My idea is, because postgres is not a human user,
these aliases are not set. I think, if
I'm working on a HP-UX system, so some of the
following has to be adapted, but in principle
it's the same on every system and it works.
First piece of code is a standalone program,
which you should always write and test before
you start creating C functions inside PostgreSQL.
Second piece is