The man page for createlang refers to the --echo option, but in fact
that option does not exist.

This patch implements it and also expands the man page for a couple of
options that were not documented.

diff -ur postgresql-7.1RC3/doc/src/sgml/ref/createlang.sgml 
postgresql-7.1cRC3/doc/src/sgml/ref/createlang.sgml
--- postgresql-7.1RC3/doc/src/sgml/ref/createlang.sgml  Sun Jan  7 02:03:28 2001
+++ postgresql-7.1cRC3/doc/src/sgml/ref/createlang.sgml Sat Apr  7 08:56:26 2001
@@ -62,11 +62,39 @@
      </varlistentry>
 
      <varlistentry>
+      <term>--pglib <replaceable class="parameter">directory</replaceable></term>
+      <listitem>
+       <para>
+       Specifies the directory in which the language interpreter is
+        to be found.
+       </para>
+      </listitem>
+     </varlistentry>
+
+     <varlistentry>
       <term>-l, --list</term>
       <listitem>
        <para>
         Shows a list of already installed languages in the target database
         (which must be specified).
+       </para>
+      </listitem>
+     </varlistentry>
+
+     <varlistentry>
+      <term>--echo</term>
+      <listitem>
+       <para>
+        Displays SQL commands as they are executed.
+       </para>
+      </listitem>
+     </varlistentry>
+
+     <varlistentry>
+      <term>-?, --help</term>
+      <listitem>
+       <para>
+        Shows a brief help message.
        </para>
       </listitem>
      </varlistentry>
diff -ur postgresql-7.1RC3/src/bin/scripts/createlang.sh 
postgresql-7.1cRC3/src/bin/scripts/createlang.sh
--- postgresql-7.1RC3/src/bin/scripts/createlang.sh     Fri Feb 23 18:12:18 2001
+++ postgresql-7.1cRC3/src/bin/scripts/createlang.sh    Sat Apr  7 07:59:18 2001
@@ -98,6 +98,9 @@
                 PGLIB=`echo "$1" | sed 's/^--pglib=//'`
                 ;;
 
+       --echo)
+               listcmd=TRUE
+               ;;
        -*)
                echo "$CMDNAME: invalid option: $1" 1>&2
                 echo "Try '$CMDNAME --help' for more information." 1>&2
@@ -155,7 +158,12 @@
 # List option
 # ----------
 if [ "$list" ]; then
-        ${PATHNAME}psql $PSQLOPT -d "$dbname" -P 'title=Procedural languages' -c 
"SELECT lanname as \"Name\", lanpltrusted as \"Trusted?\", lancompiler as \"Compiler\" 
FROM pg_language WHERE lanispl = 't'"
+       sqlcmd="SELECT lanname as \"Name\", lanpltrusted as \"Trusted?\", lancompiler 
+as \"Compiler\" FROM pg_language WHERE lanispl = 't'"
+       if [ -n "$listcmd" ]
+       then
+               echo $sqlcmd
+       fi
+        ${PATHNAME}psql $PSQLOPT -d "$dbname" -P 'title=Procedural languages' -c 
+"$sqlcmd"
         exit $?
 fi
 
@@ -237,7 +245,12 @@
 # ----------
 # Make sure the language isn't already installed
 # ----------
-res=`$PSQL "SELECT oid FROM pg_language WHERE lanname = '$langname'"`
+sqlcmd="SELECT oid FROM pg_language WHERE lanname = '$langname'"
+if [ -n "$listcmd" ]
+then
+       echo $sqlcmd
+fi
+res=`$PSQL "$sqlcmd"`
 if [ $? -ne 0 ]; then
        echo "$CMDNAME: external error" 1>&2
        exit 1
@@ -251,7 +264,12 @@
 # ----------
 # Check that there is no function named as the call handler
 # ----------
-res=`$PSQL "SELECT oid FROM pg_proc WHERE proname = '$handler'"`
+sqlcmd="SELECT oid FROM pg_proc WHERE proname = '$handler'"
+if [ -n "$listcmd" ]
+then
+       echo $sqlcmd
+fi
+res=`$PSQL "$sqlcmd"`
 if [ ! -z "$res" ]; then
        echo "$CMDNAME: A function named '$handler' already exists. Installation 
aborted." 1>&2
        exit 1
@@ -260,13 +278,23 @@
 # ----------
 # Create the call handler and the language
 # ----------
-$PSQL "CREATE FUNCTION $handler () RETURNS OPAQUE AS '$PGLIB/${object}$DLSUFFIX' 
LANGUAGE 'C'"
+sqlcmd="CREATE FUNCTION $handler () RETURNS OPAQUE AS '$PGLIB/${object}$DLSUFFIX' 
+LANGUAGE 'C'"
+if [ -n "$listcmd" ]
+then
+       echo $sqlcmd
+fi
+$PSQL "$sqlcmd"
 if [ $? -ne 0 ]; then
        echo "$CMDNAME: language installation failed" 1>&2
        exit 1
 fi
 
-$PSQL "CREATE ${trusted}PROCEDURAL LANGUAGE '$langname' HANDLER $handler LANCOMPILER 
'$lancomp'"
+sqlcmd="CREATE ${trusted}PROCEDURAL LANGUAGE '$langname' HANDLER $handler LANCOMPILER 
+'$lancomp'"
+if [ -n "$listcmd" ]
+then
+       echo $sqlcmd
+fi
+$PSQL "$sqlcmd"
 if [ $? -ne 0 ]; then
        echo "$CMDNAME: language installation failed" 1>&2
        exit 1

-- 
Oliver Elphick                                [EMAIL PROTECTED]
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "I sought the Lord, and he answered me; he delivered me
      from all my fears."       Psalm 34:4  


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to