From 6476b5533e19d9a8679a89bebcf1fe82e86ffd25 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Tue, 21 Jul 2015 09:32:22 -0500 Subject: [PATCH] Add List All Versions Of A Function as a postgres til. --- README.md | 1 + postgres/list-all-versions-of-a-function.md | 57 +++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 postgres/list-all-versions-of-a-function.md diff --git a/README.md b/README.md index 00ad810..ec505be 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Intervals Of Time By Week](postgres/intervals-of-time-by-week.md) - [Limit Execution Time Of Statements](postgres/limit-execution-time-of-statements.md) - [List All Columns Of A Specific Type](postgres/list-all-columns-of-a-specific-type.md) +- [List All Versions Of A Function](postgres/list-all-versions-of-a-function.md) - [Send A Command To psql](postgres/send-a-command-to-psql.md) - [Special Math Operators](postgres/special-math-operators.md) - [String Contains Another String](postgres/string-contains-another-string.md) diff --git a/postgres/list-all-versions-of-a-function.md b/postgres/list-all-versions-of-a-function.md new file mode 100644 index 0000000..b6e0340 --- /dev/null +++ b/postgres/list-all-versions-of-a-function.md @@ -0,0 +1,57 @@ +# List All Versions Of A Function + +Within `psql` you can use `\df` to list a postgres function with a given +name + +```sql +> \df now + List of functions + Schema | Name | Result data type | Argument data types | Type +------------+------+--------------------------+---------------------+-------- + pg_catalog | now | timestamp with time zone | | normal +(1 row) +``` + +When a function has multiple definitions across a number of types, `\df` +will list all versions of that function + +```sql +> \df generate_series +List of functions +-[ RECORD 1 ]-------+------------------------------------------------------------------- +Schema | pg_catalog +Name | generate_series +Result data type | SETOF bigint +Argument data types | bigint, bigint +Type | normal +-[ RECORD 2 ]-------+------------------------------------------------------------------- +Schema | pg_catalog +Name | generate_series +Result data type | SETOF bigint +Argument data types | bigint, bigint, bigint +Type | normal +-[ RECORD 3 ]-------+------------------------------------------------------------------- +Schema | pg_catalog +Name | generate_series +Result data type | SETOF integer +Argument data types | integer, integer +Type | normal +-[ RECORD 4 ]-------+------------------------------------------------------------------- +Schema | pg_catalog +Name | generate_series +Result data type | SETOF integer +Argument data types | integer, integer, integer +Type | normal +-[ RECORD 5 ]-------+------------------------------------------------------------------- +Schema | pg_catalog +Name | generate_series +Result data type | SETOF timestamp with time zone +Argument data types | timestamp with time zone, timestamp with time zone, interval +Type | normal +-[ RECORD 6 ]-------+------------------------------------------------------------------- +Schema | pg_catalog +Name | generate_series +Result data type | SETOF timestamp without time zone +Argument data types | timestamp without time zone, timestamp without time zone, interval +Type | normal +```