From 1704887cb175587895fbbd6e73fd7b7b14eaf6bd Mon Sep 17 00:00:00 2001 From: "Elf M. Sternberg" Date: Tue, 12 Jul 2016 15:32:18 -0700 Subject: [PATCH] Fixing typos, adding examples. --- README.rst | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 9be7d0c..7b3d62f 100644 --- a/README.rst +++ b/README.rst @@ -1,13 +1,30 @@ Synopsis -------- -`basename.sql` contains functions which provide the POSIX-equivalent -functions `basename` and `dirname` of PostgreSQL. The functions are -written in fairly standard PL/pgSQL, and should work with any version of -PostgreSQL after version 6. +``basename.sql`` contains functions which provide equivalents to the +POSIX functions ``basename`` and ``dirname`` for PostgreSQL, and can be +used in any Postgres SQL command. The functions are written in fairly +standard PL/pgSQL, and should work with any version of PostgreSQL after +version 6. I make no claim that these functions are SQL/PSM-compliant. +Example +------- + +I created these handlers to help with finding nested folders in my music +catalog program, `Catalogia_`. + +``SELECT dirname(mp3a.path) AS parent, + dirname(mp3b.path) AS child + FROM catalog_mp3 AS mp3a, + catalog_mp3 AS mp3b + WHERE dirname(mp3a.path) != dirname(mp3b.path) + AND ('^' || dirname(mp3b.path)) ~ dirname(mp3a.path); +`` + +By the way, that's *hideously* inefficient, but it worked as a demo! + LICENSE AND COPYRIGHT NOTICE: NO WARRANTY GRANTED OR IMPLIED ------------------------------------------------------------