Skip to content

Instantly share code, notes, and snippets.

@judell
Last active September 28, 2021 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save judell/d6b81d9775c814f45dd541d9f254042c to your computer and use it in GitHub Desktop.
Save judell/d6b81d9775c814f45dd541d9f254042c to your computer and use it in GitHub Desktop.
Find an internal Postgres function

I saw a use of the internal function glob(text) and couldn't find anything about it in the docs.

Thanks to https://gist.github.com/ianpgall/9492728#file-postgres-view-functions-sql:

> select * from showfunctions where function_definition ~ 'glob';
+---------+----------------------------+---------------------------------------------------------+
| lanname | function_definition        | source                                                  |
+---------+----------------------------+---------------------------------------------------------+
| plpgsql | text = internal.glob(text) | \n\n                                                    |
|         |                            | declare                                                 |
|         |                            |     output_pattern text;                                |
|         |                            | begin                                                   |
|         |                            |     output_pattern = replace(input_glob, '*', '%');     |
|         |                            |     output_pattern = replace(output_pattern, '?', '_'); |
|         |                            |     return output_pattern;                              |
|         |                            | end;                                                    |
|         |                            | \n\n                                                    |
+---------+----------------------------+---------------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment