[inet_client_addr() is a system information function.][1] It is located in the schema `pg_catalog` like other built-in functions (except for additional modules). `pg_catalog` is automatically part of the [`search_path`][2]. [Per documentation:][3] > In addition to `public` and user-created schemas, each database contains > a `pg_catalog` schema, which contains the system tables and all the > built-in data types, functions, and operators. `pg_catalog` is always > effectively part of the search path. If it is not named explicitly in > the path then it is implicitly searched before searching the path's > schemas. This ensures that built-in names will always be findable. > However, you can explicitly place `pg_catalog` at the end of your search > path if you prefer to have user-defined names override built-in names. To override the function you have to force another schema *before* `pg_catalog` in the `search_path`. For that you have to name it explicitly in second place: CREATE SCHEMA override; CREATE OR REPLACE FUNCTION override.inet_client_addr() RETURNS inet AS $func$ SELECT '127.0.0.1'::inet $func$ language sql STABLE; <pre><code>SET search_path = <b>override, pg_catalog</b>, public; </code></pre> Then your call finds the override-function first: SELECT inet_client_addr(); [SQL Fiddle][4] Make sure, unprivileged users cannot create objects in the override schema, or they can play all kinds of tricks on you. [1]: http://www.postgresql.org/docs/current/interactive/functions-info.html [2]: http://stackoverflow.com/questions/9067335/how-to-create-table-inside-specific-schema-by-default-in-postgres/9067777#9067777 [3]: http://www.postgresql.org/docs/current/interactive/ddl-schemas.html#DDL-SCHEMAS-CATALOG [4]: http://sqlfiddle.com/#!15/037e8/1