From 003dc785340a37764925a1189b65aca52232899c Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sun, 12 Jul 2015 16:27:34 -0500 Subject: [PATCH] Add Edit Existing Functions as a postgres til. --- README.md | 1 + postgres/edit-existing-functions.md | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 postgres/edit-existing-functions.md diff --git a/README.md b/README.md index 5405cbc..322a83f 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Configure The Timezone](postgres/configure-the-timezone.md) - [Count Records By Type](postgres/count-records-by-type.md) - [Default Schema](postgres/default-schema.md) +- [Edit Existing Functions](postgres/edit-existing-functions.md) - [Extracting Nested JSON Data](postgres/extracting-nested-json-data.md) - [Fizzbuzz With Common Table Expressions](postgres/fizzbuzz-with-common-table-expressions.md) - [Generate Series Of Numbers](postgres/generate-series-of-numbers.md) diff --git a/postgres/edit-existing-functions.md b/postgres/edit-existing-functions.md new file mode 100644 index 0000000..260a11b --- /dev/null +++ b/postgres/edit-existing-functions.md @@ -0,0 +1,21 @@ +# Edit Existing Functions + +In the `psql` console, use `\ef` with the name of a function to fetch and +open the definition of the function. The function will be opened in your +system `$EDITOR` in the form of the `create or replace function` query. + +Executing + +```sql +> \ef now +``` + +will open the following in your default editor + +```sql +CREATE OR REPLACE FUNCTION pg_catalog.now()¬ + RETURNS timestamp with time zone¬ + LANGUAGE internal¬ + STABLE STRICT¬ +AS $function$now$function$¬ +```