
(If you omit the name for an output argument, the system will choose a default column name.) argtype In any case, the name of an output argument is significant, because it defines the column name in the result row type. For other languages the name of an input argument is just extra documentation, so far as the function itself is concerned but you can use input argument names when calling a function to improve readability (see Section 4.3). Some languages (including SQL and PL/pgSQL) let you use the name in the function body.

Also, OUT and INOUT arguments cannot be used together with the RETURNS TABLE notation. Only OUT arguments can follow a VARIADIC one. The mode of an argument: IN, OUT, INOUT, or VARIADIC. The name (optionally schema-qualified) of the function to create. Refer to Section 38.3 for further information on writing functions. To be able to create a function, you must have USAGE privilege on the argument types and the return type. The user that creates the function becomes the owner of the function. Also, ALTER FUNCTION can be used to change most of the auxiliary properties of an existing function. Use CREATE OR REPLACE FUNCTION to change a function definition without breaking objects that refer to the function. If you drop and then recreate a function, the new function is not the same entity as the old you will have to drop existing rules, views, triggers, etc. You must own the function to replace it (this includes being a member of the owning role). All other function properties are assigned the values specified or implied in the command. When CREATE OR REPLACE FUNCTION is used to replace an existing function, the ownership and permissions of the function do not change. (When using OUT parameters, that means you cannot change the types of any OUT parameters except by dropping the function.) To do that, you must drop and recreate the function. Also, CREATE OR REPLACE FUNCTION will not let you change the return type of an existing function. It is not possible to change the name or argument types of a function this way (if you tried, you would actually be creating a new, distinct function). To replace the current definition of an existing function, use CREATE OR REPLACE FUNCTION.

However, functions and procedures of different argument types can share a name (this is called overloading). The name of the new function must not match any existing function or procedure with the same input argument types in the same schema.

Otherwise it is created in the current schema. If a schema name is included, then the function is created in the specified schema. To be able to define a function, the user must have the USAGE privilege on the language. CREATE OR REPLACE FUNCTION will either create a new function, or replace an existing definition.
