<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.15 2000/12/25 23:15:26 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.16 2001/05/09 22:08:18 petere Exp $
Postgres documentation
-->
<refentry id="APP-CREATELANG">
<docinfo>
- <date>2000-11-11</date>
+ <date>2001-05-09</date>
</docinfo>
<refmeta>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>-e, --echo</term>
+ <listitem>
+ <para>
+ Displays SQL commands as they are executed.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>-l, --list</term>
<listitem>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>--L <replaceable class="parameter">directory</replaceable></term>
+ <listitem>
+ <para>
+ Specifies the directory in which the language interpreter is
+ to be found. This is normally found automatically.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</para>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/droplang.sgml,v 1.9 2000/12/25 23:15:26 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/droplang.sgml,v 1.10 2001/05/09 22:08:18 petere Exp $
Postgres documentation
-->
<refentry id="APP-DROPLANG">
<docinfo>
- <date>2000-11-11</date>
+ <date>2001-05-09</date>
</docinfo>
<refmeta>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>-e, --echo</term>
+ <listitem>
+ <para>
+ Displays SQL commands as they are executed.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>-l, --list</term>
<listitem>
-#!/bin/sh
+#! /bin/sh
#-------------------------------------------------------------------------
#
-# createlang.sh--
-# Install a procedural language in a database
+# createlang --
+# Install a procedural language in a database
#
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-#
-# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.23 2001/02/18 18:34:01 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.24 2001/05/09 22:08:19 petere Exp $
#
#-------------------------------------------------------------------------
dbname=
langname=
list=
+showsql=
# Check for echo -n vs echo \c
--pglib=*)
PGLIB=`echo "$1" | sed 's/^--pglib=//'`
;;
+ --echo|-e)
+ showsql=yes
+ ;;
-*)
echo "$CMDNAME: invalid option: $1" 1>&2
# ----------
if [ -z "$dbname" ]; then
echo "$CMDNAME: missing required argument database name" 1>&2
- echo "Try '$CMDNAME -?' for help." 1>&2
+ echo "Try '$CMDNAME --help' for help." 1>&2
exit 1
fi
# 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 [ "$showsql" = yes ]; then
+ echo "$sqlcmd"
+ fi
+ ${PATHNAME}psql $PSQLOPT -d "$dbname" -P 'title=Procedural languages' -c "$sqlcmd"
exit $?
fi
# ----------
# 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 [ "$showsql" = yes ]; then
+ echo "$sqlcmd"
+fi
+res=`$PSQL "$sqlcmd"`
if [ $? -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
# ----------
# 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 [ "$showsql" = yes ]; 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
# ----------
# 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 [ "$showsql" = yes ]; 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 [ "$showsql" = yes ]; then
+ echo "$sqlcmd"
+fi
+$PSQL "$sqlcmd"
if [ $? -ne 0 ]; then
echo "$CMDNAME: language installation failed" 1>&2
exit 1
-#!/bin/sh
+#! /bin/sh
#-------------------------------------------------------------------------
#
-# createlang--
-# Remove a procedural language from a database
+# droplang --
+# Remove a procedural language from a database
#
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-#
-# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.13 2001/02/18 18:34:01 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.14 2001/05/09 22:08:19 petere Exp $
#
#-------------------------------------------------------------------------
langname=
echo=
list=
+showsql=
# Check for echo -n vs echo \c
--dbname=*)
dbname=`echo "$1" | sed 's/^--dbname=//'`
;;
+ --echo|-e)
+ showsql=yes
+ ;;
-*)
echo "$CMDNAME: invalid option: $1" 1>&2
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 [ "$showsql" = yes ]; then
+ echo "$sqlcmd"
+ fi
+ ${PATHNAME}psql $PSQLOPT -d "$dbname" -P 'title=Procedural languages' -c "$sqlcmd"
exit $?
fi
# ----------
if [ -z "$dbname" ]; then
echo "$CMDNAME: missing required argument database name" 1>&2
- echo "Try '$CMDNAME -?' for help." 1>&2
+ echo "Try '$CMDNAME --help' for help." 1>&2
exit 1
fi
# ----------
# Make sure the language is installed
# ----------
-res=`$PSQL "SELECT oid FROM pg_language WHERE lanname = '$langname'"`
+sqlcmd="SELECT oid FROM pg_language WHERE lanname = '$langname';"
+if [ "$showsql" = yes ]; then
+ echo "$sqlcmd"
+fi
+res=`$PSQL "$sqlcmd"`
if [ $? -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
# ----------
# Check that there are no functions left defined in that language
# ----------
-res=`$PSQL "SELECT COUNT(proname) FROM pg_proc P, pg_language L WHERE P.prolang = L.oid AND L.lanname = '$langname'"`
+sqlcmd="SELECT COUNT(proname) FROM pg_proc P, pg_language L WHERE P.prolang = L.oid AND L.lanname = '$langname';"
+if [ "$showsql" = yes ]; then
+ echo "$sqlcmd"
+fi
+res=`$PSQL "$sqlcmd"`
if [ $? -ne 0 ]; then
echo "$CMDNAME: external error" 1>&2
exit 1
# ----------
# Drop the language and the call handler function
# ----------
-$PSQL "DROP PROCEDURAL LANGUAGE '$langname'"
+sqlcmd="DROP PROCEDURAL LANGUAGE '$langname';"
+if [ "$showsql" = yes ]; then
+ echo "$sqlcmd"
+fi
+$PSQL "$sqlcmd"
if [ $? -ne 0 ]; then
echo "$CMDNAME: language removal failed" 1>&2
exit 1
fi
-$PSQL "DROP FUNCTION $handler()"
+
+sqlcmd="DROP FUNCTION $handler();"
+if [ "$showsql" = yes ]; then
+ echo "$sqlcmd"
+fi
+$PSQL "$sqlcmd"
if [ $? -ne 0 ]; then
echo "$CMDNAME: language removal failed" 1>&2
exit 1