{
    "mode": "man",
    "parameter": "CREATE_FUNCTION",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/CREATE_FUNCTION/7/json",
    "generated": "2026-06-15T11:08:57Z",
    "synopsis": "CREATE [ OR REPLACE ] FUNCTION\nname ( [ [ argmode ] [ argname ] argtype [ { DEFAULT | = } defaultexpr ] [, ...] ] )\n[ RETURNS rettype\n| RETURNS TABLE ( columnname columntype [, ...] ) ]\n{ LANGUAGE langname\n| TRANSFORM { FOR TYPE typename } [, ... ]\n| WINDOW\n| { IMMUTABLE | STABLE | VOLATILE }\n| [ NOT ] LEAKPROOF\n| { CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT }\n| { [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER }\n| PARALLEL { UNSAFE | RESTRICTED | SAFE }\n| COST executioncost\n| ROWS resultrows\n| SUPPORT supportfunction\n| SET configurationparameter { TO value | = value | FROM CURRENT }\n| AS 'definition'\n| AS 'objfile', 'linksymbol'\n| sqlbody\n} ...",
    "sections": {
        "NAME": {
            "content": "CREATEFUNCTION - define a new function\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "CREATE [ OR REPLACE ] FUNCTION\nname ( [ [ argmode ] [ argname ] argtype [ { DEFAULT | = } defaultexpr ] [, ...] ] )\n[ RETURNS rettype\n| RETURNS TABLE ( columnname columntype [, ...] ) ]\n{ LANGUAGE langname\n| TRANSFORM { FOR TYPE typename } [, ... ]\n| WINDOW\n| { IMMUTABLE | STABLE | VOLATILE }\n| [ NOT ] LEAKPROOF\n| { CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT }\n| { [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER }\n| PARALLEL { UNSAFE | RESTRICTED | SAFE }\n| COST executioncost\n| ROWS resultrows\n| SUPPORT supportfunction\n| SET configurationparameter { TO value | = value | FROM CURRENT }\n| AS 'definition'\n| AS 'objfile', 'linksymbol'\n| sqlbody\n} ...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "CREATE FUNCTION defines a new function.  CREATE OR REPLACE FUNCTION will either create a new\nfunction, or replace an existing definition. To be able to define a function, the user must\nhave the USAGE privilege on the language.\n\nIf a schema name is included, then the function is created in the specified schema. Otherwise\nit is created in the current schema. The name of the new function must not match any existing\nfunction or procedure with the same input argument types in the same schema. However,\nfunctions and procedures of different argument types can share a name (this is called\noverloading).\n\nTo replace the current definition of an existing function, use CREATE OR REPLACE FUNCTION. It\nis not possible to change the name or argument types of a function this way (if you tried,\nyou would actually be creating a new, distinct function). Also, CREATE OR REPLACE FUNCTION\nwill not let you change the return type of an existing function. To do that, you must drop\nand recreate the function. (When using OUT parameters, that means you cannot change the types\nof any OUT parameters except by dropping the function.)\n\nWhen CREATE OR REPLACE FUNCTION is used to replace an existing function, the ownership and\npermissions of the function do not change. All other function properties are assigned the\nvalues specified or implied in the command. You must own the function to replace it (this\nincludes being a member of the owning role).\n\nIf you drop and then recreate a function, the new function is not the same entity as the old;\nyou will have to drop existing rules, views, triggers, etc. that refer to the old function.\nUse CREATE OR REPLACE FUNCTION to change a function definition without breaking objects that\nrefer to the function. Also, ALTER FUNCTION can be used to change most of the auxiliary\nproperties of an existing function.\n\nThe user that creates the function becomes the owner of the function.\n\nTo be able to create a function, you must have USAGE privilege on the argument types and the\nreturn type.\n\nRefer to Section 38.3 for further information on writing functions.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "name\nThe name (optionally schema-qualified) of the function to create.\n\nargmode\nThe mode of an argument: IN, OUT, INOUT, or VARIADIC. If omitted, the default is IN. Only\nOUT arguments can follow a VARIADIC one. Also, OUT and INOUT arguments cannot be used\ntogether with the RETURNS TABLE notation.\n\nargname\nThe name of an argument. Some languages (including SQL and PL/pgSQL) let you use the name\nin the function body. For other languages the name of an input argument is just extra\ndocumentation, so far as the function itself is concerned; but you can use input argument\nnames when calling a function to improve readability (see Section 4.3). In any case, the\nname of an output argument is significant, because it defines the column name in the\nresult row type. (If you omit the name for an output argument, the system will choose a\ndefault column name.)\n\nargtype\nThe data type(s) of the function's arguments (optionally schema-qualified), if any. The\nargument types can be base, composite, or domain types, or can reference the type of a\ntable column.\n\nDepending on the implementation language it might also be allowed to specify\n“pseudo-types” such as cstring. Pseudo-types indicate that the actual argument type is\neither incompletely specified, or outside the set of ordinary SQL data types.\n\nThe type of a column is referenced by writing tablename.columnname%TYPE. Using this\nfeature can sometimes help make a function independent of changes to the definition of a\ntable.\n\ndefaultexpr\nAn expression to be used as default value if the parameter is not specified. The\nexpression has to be coercible to the argument type of the parameter. Only input\n(including INOUT) parameters can have a default value. All input parameters following a\nparameter with a default value must have default values as well.\n\nrettype\nThe return data type (optionally schema-qualified). The return type can be a base,\ncomposite, or domain type, or can reference the type of a table column. Depending on the\nimplementation language it might also be allowed to specify “pseudo-types” such as\ncstring. If the function is not supposed to return a value, specify void as the return\ntype.\n\nWhen there are OUT or INOUT parameters, the RETURNS clause can be omitted. If present, it\nmust agree with the result type implied by the output parameters: RECORD if there are\nmultiple output parameters, or the same type as the single output parameter.\n\nThe SETOF modifier indicates that the function will return a set of items, rather than a\nsingle item.\n\nThe type of a column is referenced by writing tablename.columnname%TYPE.\n\ncolumnname\nThe name of an output column in the RETURNS TABLE syntax. This is effectively another way\nof declaring a named OUT parameter, except that RETURNS TABLE also implies RETURNS SETOF.\n\ncolumntype\nThe data type of an output column in the RETURNS TABLE syntax.\n\nlangname\nThe name of the language that the function is implemented in. It can be sql, c, internal,\nor the name of a user-defined procedural language, e.g., plpgsql. The default is sql if\nsqlbody is specified. Enclosing the name in single quotes is deprecated and requires\nmatching case.\n\nTRANSFORM { FOR TYPE typename } [, ... ] }\nLists which transforms a call to the function should apply. Transforms convert between\nSQL types and language-specific data types; see CREATE TRANSFORM (CREATETRANSFORM(7)).\nProcedural language implementations usually have hardcoded knowledge of the built-in\ntypes, so those don't need to be listed here. If a procedural language implementation\ndoes not know how to handle a type and no transform is supplied, it will fall back to a\ndefault behavior for converting data types, but this depends on the implementation.\n\nWINDOW\nWINDOW indicates that the function is a window function rather than a plain function.\nThis is currently only useful for functions written in C. The WINDOW attribute cannot be\nchanged when replacing an existing function definition.\n\nIMMUTABLE\nSTABLE\nVOLATILE\nThese attributes inform the query optimizer about the behavior of the function. At most\none choice can be specified. If none of these appear, VOLATILE is the default assumption.\n\nIMMUTABLE indicates that the function cannot modify the database and always returns the\nsame result when given the same argument values; that is, it does not do database lookups\nor otherwise use information not directly present in its argument list. If this option is\ngiven, any call of the function with all-constant arguments can be immediately replaced\nwith the function value.\n\nSTABLE indicates that the function cannot modify the database, and that within a single\ntable scan it will consistently return the same result for the same argument values, but\nthat its result could change across SQL statements. This is the appropriate selection for\nfunctions whose results depend on database lookups, parameter variables (such as the\ncurrent time zone), etc. (It is inappropriate for AFTER triggers that wish to query rows\nmodified by the current command.) Also note that the currenttimestamp family of\nfunctions qualify as stable, since their values do not change within a transaction.\n\nVOLATILE indicates that the function value can change even within a single table scan, so\nno optimizations can be made. Relatively few database functions are volatile in this\nsense; some examples are random(), currval(), timeofday(). But note that any function\nthat has side-effects must be classified volatile, even if its result is quite\npredictable, to prevent calls from being optimized away; an example is setval().\n\nFor additional details see Section 38.7.\n\nLEAKPROOF\nLEAKPROOF indicates that the function has no side effects. It reveals no information\nabout its arguments other than by its return value. For example, a function which throws\nan error message for some argument values but not others, or which includes the argument\nvalues in any error message, is not leakproof. This affects how the system executes\nqueries against views created with the securitybarrier option or tables with row level\nsecurity enabled. The system will enforce conditions from security policies and security\nbarrier views before any user-supplied conditions from the query itself that contain\nnon-leakproof functions, in order to prevent the inadvertent exposure of data. Functions\nand operators marked as leakproof are assumed to be trustworthy, and may be executed\nbefore conditions from security policies and security barrier views. In addition,\nfunctions which do not take arguments or which are not passed any arguments from the\nsecurity barrier view or table do not have to be marked as leakproof to be executed\nbefore security conditions. See CREATE VIEW (CREATEVIEW(7)) and Section 41.5. This\noption can only be set by the superuser.\n\nCALLED ON NULL INPUT\nRETURNS NULL ON NULL INPUT\nSTRICT\nCALLED ON NULL INPUT (the default) indicates that the function will be called normally\nwhen some of its arguments are null. It is then the function author's responsibility to\ncheck for null values if necessary and respond appropriately.\n\nRETURNS NULL ON NULL INPUT or STRICT indicates that the function always returns null\nwhenever any of its arguments are null. If this parameter is specified, the function is\nnot executed when there are null arguments; instead a null result is assumed\nautomatically.\n\n[EXTERNAL] SECURITY INVOKER\n[EXTERNAL] SECURITY DEFINER\nSECURITY INVOKER indicates that the function is to be executed with the privileges of the\nuser that calls it. That is the default.  SECURITY DEFINER specifies that the function is\nto be executed with the privileges of the user that owns it.\n\nThe key word EXTERNAL is allowed for SQL conformance, but it is optional since, unlike in\nSQL, this feature applies to all functions not only external ones.\n\nPARALLEL\nPARALLEL UNSAFE indicates that the function can't be executed in parallel mode and the\npresence of such a function in an SQL statement forces a serial execution plan. This is\nthe default.  PARALLEL RESTRICTED indicates that the function can be executed in parallel\nmode, but the execution is restricted to parallel group leader.  PARALLEL SAFE indicates\nthat the function is safe to run in parallel mode without restriction.\n\nFunctions should be labeled parallel unsafe if they modify any database state, or if they\nmake changes to the transaction such as using sub-transactions, or if they access\nsequences or attempt to make persistent changes to settings (e.g., setval). They should\nbe labeled as parallel restricted if they access temporary tables, client connection\nstate, cursors, prepared statements, or miscellaneous backend-local state which the\nsystem cannot synchronize in parallel mode (e.g., setseed cannot be executed other than\nby the group leader because a change made by another process would not be reflected in\nthe leader). In general, if a function is labeled as being safe when it is restricted or\nunsafe, or if it is labeled as being restricted when it is in fact unsafe, it may throw\nerrors or produce wrong answers when used in a parallel query. C-language functions could\nin theory exhibit totally undefined behavior if mislabeled, since there is no way for the\nsystem to protect itself against arbitrary C code, but in most likely cases the result\nwill be no worse than for any other function. If in doubt, functions should be labeled as\nUNSAFE, which is the default.\n\nCOST executioncost\nA positive number giving the estimated execution cost for the function, in units of\ncpuoperatorcost. If the function returns a set, this is the cost per returned row. If\nthe cost is not specified, 1 unit is assumed for C-language and internal functions, and\n100 units for functions in all other languages. Larger values cause the planner to try to\navoid evaluating the function more often than necessary.\n\nROWS resultrows\nA positive number giving the estimated number of rows that the planner should expect the\nfunction to return. This is only allowed when the function is declared to return a set.\nThe default assumption is 1000 rows.\n\nSUPPORT supportfunction\nThe name (optionally schema-qualified) of a planner support function to use for this\nfunction. See Section 38.11 for details. You must be superuser to use this option.\n\nconfigurationparameter\nvalue\nThe SET clause causes the specified configuration parameter to be set to the specified\nvalue when the function is entered, and then restored to its prior value when the\nfunction exits.  SET FROM CURRENT saves the value of the parameter that is current when\nCREATE FUNCTION is executed as the value to be applied when the function is entered.\n\nIf a SET clause is attached to a function, then the effects of a SET LOCAL command\nexecuted inside the function for the same variable are restricted to the function: the\nconfiguration parameter's prior value is still restored at function exit. However, an\nordinary SET command (without LOCAL) overrides the SET clause, much as it would do for a\nprevious SET LOCAL command: the effects of such a command will persist after function\nexit, unless the current transaction is rolled back.\n\nSee SET(7) and Chapter 20 for more information about allowed parameter names and values.\n\ndefinition\nA string constant defining the function; the meaning depends on the language. It can be\nan internal function name, the path to an object file, an SQL command, or text in a\nprocedural language.\n\nIt is often helpful to use dollar quoting (see Section 4.1.2.4) to write the function\ndefinition string, rather than the normal single quote syntax. Without dollar quoting,\nany single quotes or backslashes in the function definition must be escaped by doubling\nthem.\n\nobjfile, linksymbol\nThis form of the AS clause is used for dynamically loadable C language functions when the\nfunction name in the C language source code is not the same as the name of the SQL\nfunction. The string objfile is the name of the shared library file containing the\ncompiled C function, and is interpreted as for the LOAD command. The string linksymbol\nis the function's link symbol, that is, the name of the function in the C language source\ncode. If the link symbol is omitted, it is assumed to be the same as the name of the SQL\nfunction being defined. The C names of all functions must be different, so you must give\noverloaded C functions different C names (for example, use the argument types as part of\nthe C names).\n\nWhen repeated CREATE FUNCTION calls refer to the same object file, the file is only\nloaded once per session. To unload and reload the file (perhaps during development),\nstart a new session.\n\nsqlbody\nThe body of a LANGUAGE SQL function. This can either be a single statement\n\nRETURN expression\n\nor a block\n\nBEGIN ATOMIC\nstatement;\nstatement;\n...\nstatement;\nEND\n\nThis is similar to writing the text of the function body as a string constant (see\ndefinition above), but there are some differences: This form only works for LANGUAGE SQL,\nthe string constant form works for all languages. This form is parsed at function\ndefinition time, the string constant form is parsed at execution time; therefore this\nform cannot support polymorphic argument types and other constructs that are not\nresolvable at function definition time. This form tracks dependencies between the\nfunction and objects used in the function body, so DROP ... CASCADE will work correctly,\nwhereas the form using string literals may leave dangling functions. Finally, this form\nis more compatible with the SQL standard and other SQL implementations.\n",
            "subsections": []
        },
        "OVERLOADING": {
            "content": "PostgreSQL allows function overloading; that is, the same name can be used for several\ndifferent functions so long as they have distinct input argument types. Whether or not you\nuse it, this capability entails security precautions when calling functions in databases\nwhere some users mistrust other users; see Section 10.3.\n\nTwo functions are considered the same if they have the same names and input argument types,\nignoring any OUT parameters. Thus for example these declarations conflict:\n\nCREATE FUNCTION foo(int) ...\nCREATE FUNCTION foo(int, out text) ...\n\nFunctions that have different argument type lists will not be considered to conflict at\ncreation time, but if defaults are provided they might conflict in use. For example, consider\n\nCREATE FUNCTION foo(int) ...\nCREATE FUNCTION foo(int, int default 42) ...\n\nA call foo(10) will fail due to the ambiguity about which function should be called.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "The full SQL type syntax is allowed for declaring a function's arguments and return value.\nHowever, parenthesized type modifiers (e.g., the precision field for type numeric) are\ndiscarded by CREATE FUNCTION. Thus for example CREATE FUNCTION foo (varchar(10)) ...  is\nexactly the same as CREATE FUNCTION foo (varchar) ....\n\nWhen replacing an existing function with CREATE OR REPLACE FUNCTION, there are restrictions\non changing parameter names. You cannot change the name already assigned to any input\nparameter (although you can add names to parameters that had none before). If there is more\nthan one output parameter, you cannot change the names of the output parameters, because that\nwould change the column names of the anonymous composite type that describes the function's\nresult. These restrictions are made to ensure that existing calls of the function do not stop\nworking when it is replaced.\n\nIf a function is declared STRICT with a VARIADIC argument, the strictness check tests that\nthe variadic array as a whole is non-null. The function will still be called if the array has\nnull elements.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Add two integers using an SQL function:\n\nCREATE FUNCTION add(integer, integer) RETURNS integer\nAS 'select $1 + $2;'\nLANGUAGE SQL\nIMMUTABLE\nRETURNS NULL ON NULL INPUT;\n\nThe same function written in a more SQL-conforming style, using argument names and an\nunquoted body:\n\nCREATE FUNCTION add(a integer, b integer) RETURNS integer\nLANGUAGE SQL\nIMMUTABLE\nRETURNS NULL ON NULL INPUT\nRETURN a + b;\n\nIncrement an integer, making use of an argument name, in PL/pgSQL:\n\nCREATE OR REPLACE FUNCTION increment(i integer) RETURNS integer AS $$\nBEGIN\nRETURN i + 1;\nEND;\n$$ LANGUAGE plpgsql;\n\nReturn a record containing multiple output parameters:\n\nCREATE FUNCTION dup(in int, out f1 int, out f2 text)\nAS $$ SELECT $1, CAST($1 AS text) || ' is text' $$\nLANGUAGE SQL;\n\nSELECT * FROM dup(42);\n\nYou can do the same thing more verbosely with an explicitly named composite type:\n\nCREATE TYPE dupresult AS (f1 int, f2 text);\n\nCREATE FUNCTION dup(int) RETURNS dupresult\nAS $$ SELECT $1, CAST($1 AS text) || ' is text' $$\nLANGUAGE SQL;\n\nSELECT * FROM dup(42);\n\nAnother way to return multiple columns is to use a TABLE function:\n\nCREATE FUNCTION dup(int) RETURNS TABLE(f1 int, f2 text)\nAS $$ SELECT $1, CAST($1 AS text) || ' is text' $$\nLANGUAGE SQL;\n\nSELECT * FROM dup(42);\n\nHowever, a TABLE function is different from the preceding examples, because it actually\nreturns a set of records, not just one record.\n",
            "subsections": []
        },
        "WRITING SECURITY DEFINER FUNCTIONS SAFELY": {
            "content": "Because a SECURITY DEFINER function is executed with the privileges of the user that owns it,\ncare is needed to ensure that the function cannot be misused. For security, searchpath\nshould be set to exclude any schemas writable by untrusted users. This prevents malicious\nusers from creating objects (e.g., tables, functions, and operators) that mask objects\nintended to be used by the function. Particularly important in this regard is the\ntemporary-table schema, which is searched first by default, and is normally writable by\nanyone. A secure arrangement can be obtained by forcing the temporary schema to be searched\nlast. To do this, write pgtemp as the last entry in searchpath. This function illustrates\nsafe usage:\n\nCREATE FUNCTION checkpassword(uname TEXT, pass TEXT)\nRETURNS BOOLEAN AS $$\nDECLARE passed BOOLEAN;\nBEGIN\nSELECT  (pwd = $2) INTO passed\nFROM    pwds\nWHERE   username = $1;\n\nRETURN passed;\nEND;\n$$  LANGUAGE plpgsql\nSECURITY DEFINER\n-- Set a secure searchpath: trusted schema(s), then 'pgtemp'.\nSET searchpath = admin, pgtemp;\n\nThis function's intention is to access a table admin.pwds. But without the SET clause, or\nwith a SET clause mentioning only admin, the function could be subverted by creating a\ntemporary table named pwds.\n\nBefore PostgreSQL version 8.3, the SET clause was not available, and so older functions may\ncontain rather complicated logic to save, set, and restore searchpath. The SET clause is far\neasier to use for this purpose.\n\nAnother point to keep in mind is that by default, execute privilege is granted to PUBLIC for\nnewly created functions (see Section 5.7 for more information). Frequently you will wish to\nrestrict use of a security definer function to only some users. To do that, you must revoke\nthe default PUBLIC privileges and then grant execute privilege selectively. To avoid having a\nwindow where the new function is accessible to all, create it and set the privileges within a\nsingle transaction. For example:\n\nBEGIN;\nCREATE FUNCTION checkpassword(uname TEXT, pass TEXT) ... SECURITY DEFINER;\nREVOKE ALL ON FUNCTION checkpassword(uname TEXT, pass TEXT) FROM PUBLIC;\nGRANT EXECUTE ON FUNCTION checkpassword(uname TEXT, pass TEXT) TO admins;\nCOMMIT;\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "A CREATE FUNCTION command is defined in the SQL standard. The PostgreSQL implementation can\nbe used in a compatible way but has many extensions. Conversely, the SQL standard specifies a\nnumber of optional features that are not implemented in PostgreSQL.\n\nThe following are important compatibility issues:\n\n•   OR REPLACE is a PostgreSQL extension.\n\n•   For compatibility with some other database systems, argmode can be written either before\nor after argname. But only the first way is standard-compliant.\n\n•   For parameter defaults, the SQL standard specifies only the syntax with the DEFAULT key\nword. The syntax with = is used in T-SQL and Firebird.\n\n•   The SETOF modifier is a PostgreSQL extension.\n\n•   Only SQL is standardized as a language.\n\n•   All other attributes except CALLED ON NULL INPUT and RETURNS NULL ON NULL INPUT are not\nstandardized.\n\n•   For the body of LANGUAGE SQL functions, the SQL standard only specifies the sqlbody\nform.\n\nSimple LANGUAGE SQL functions can be written in a way that is both standard-conforming and\nportable to other implementations. More complex functions using advanced features,\noptimization attributes, or other languages will necessarily be specific to PostgreSQL in a\nsignificant way.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "ALTER FUNCTION (ALTERFUNCTION(7)), DROP FUNCTION (DROPFUNCTION(7)), GRANT(7), LOAD(7),\nREVOKE(7)\n\n\n\nPostgreSQL 14.23                                2026                              CREATE FUNCTION(7)",
            "subsections": []
        }
    },
    "summary": "CREATEFUNCTION - define a new function",
    "flags": [],
    "examples": [
        "Add two integers using an SQL function:",
        "CREATE FUNCTION add(integer, integer) RETURNS integer",
        "AS 'select $1 + $2;'",
        "LANGUAGE SQL",
        "IMMUTABLE",
        "RETURNS NULL ON NULL INPUT;",
        "The same function written in a more SQL-conforming style, using argument names and an",
        "unquoted body:",
        "CREATE FUNCTION add(a integer, b integer) RETURNS integer",
        "LANGUAGE SQL",
        "IMMUTABLE",
        "RETURNS NULL ON NULL INPUT",
        "RETURN a + b;",
        "Increment an integer, making use of an argument name, in PL/pgSQL:",
        "CREATE OR REPLACE FUNCTION increment(i integer) RETURNS integer AS $$",
        "BEGIN",
        "RETURN i + 1;",
        "END;",
        "$$ LANGUAGE plpgsql;",
        "Return a record containing multiple output parameters:",
        "CREATE FUNCTION dup(in int, out f1 int, out f2 text)",
        "AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$",
        "LANGUAGE SQL;",
        "SELECT * FROM dup(42);",
        "You can do the same thing more verbosely with an explicitly named composite type:",
        "CREATE TYPE dupresult AS (f1 int, f2 text);",
        "CREATE FUNCTION dup(int) RETURNS dupresult",
        "AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$",
        "LANGUAGE SQL;",
        "SELECT * FROM dup(42);",
        "Another way to return multiple columns is to use a TABLE function:",
        "CREATE FUNCTION dup(int) RETURNS TABLE(f1 int, f2 text)",
        "AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$",
        "LANGUAGE SQL;",
        "SELECT * FROM dup(42);",
        "However, a TABLE function is different from the preceding examples, because it actually",
        "returns a set of records, not just one record."
    ],
    "see_also": [
        {
            "name": "ALTERFUNCTION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/ALTERFUNCTION/7/json"
        },
        {
            "name": "DROPFUNCTION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/DROPFUNCTION/7/json"
        },
        {
            "name": "GRANT",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/GRANT/7/json"
        },
        {
            "name": "LOAD",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/LOAD/7/json"
        },
        {
            "name": "REVOKE",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/REVOKE/7/json"
        },
        {
            "name": "FUNCTION",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/FUNCTION/7/json"
        }
    ]
}