Full text indexing using triggers
by Maarten Boekhold
-init.d -
-
- Init.d-style scripts for starting and stopping the PostgreSQL
- server by Ryan Kirkpatrick
-
intarray -
Index support for arrays of int4, using GiST
by Teodor Sigaev and Oleg Bartunov
PostgreSQL type extensions for ISBN (books) and ISSN (serials)
by Garrett A. Wollman
-linux -
- Scripts for starting and stopping the PostgreSQL server on
- a Linux system
- by Thomas Lockhart
-
lo -
Large Object maintenance
spi -
Various trigger functions, examples for using SPI.
+start-scripts -
+ Scripts for starting the server at boot time.
+
string -
C-like input/output conversion routines for strings
by Massimo Dal Zotto
+++ /dev/null
- postgresql -> This is a Linux distribution independent (or so I
-hope) init.d/rc.d script that makes use of pg_ctl. There is currently a
-few in ./contrib/linux of the pgsql source tree, but they are RedHat
-specific. This one is simple and self contained.
-
----------------------------------------------------------------------------
-| Ryan Kirkpatrick | Boulder, Colorado | http://www.rkirkpat.net/ |
----------------------------------------------------------------------------
+++ /dev/null
-#! /bin/sh
-#
-# PostgreSQL Start, stop, and get status on the PostgreSQL RDMBS.
-# This script is Linux distribution independent
-# (or at least should be :).
-#
-#
-# If you find any problems with this script, or have suggestions
-# please send them to me.
-
-# Arguements for pg_ctl and then for the postmaster. Change as needed.
-ARGS="-w -D /usr/local/pgsql/data"
-PM_ARGS="-i -F"
-
-# Changes should not be needed beyond this point.
-
-# The path that is to be used for the script.
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-
-# What to use to start up the postmster, and a few names.
-DAEMON=/usr/local/pgsql/bin/pg_ctl
-NAME=postmaster
-FILE=postgresql
-DESC="PostgreSQL RDBMS"
-
-# Who to run pg_ctl as, should be postgres.
-USER="postgres:postgres"
-
-# Where to keep a log file.
-LOG="/usr/local/pgsql/server.log"
-
-# Only start if we can find pg_ctl.
-test -f $DAEMON || exit 0
-set -e
-
-# Parse command line parameters.
-case "$1" in
- start)
- # Start the postmaster using pg_ctl and given options.
- echo -n "Starting $DESC: "
- su - postgres sh -c "$DAEMON start $ARGS -o \"$PM_ARGS\" > $LOG 2>&1"
- echo "$NAME."
- ;;
- stop)
- # Stop the postmaster using pg_ctl.
- echo -n "Stopping $DESC: "
- su - postgres sh -c "$DAEMON stop > /dev/null 2>&1"
- echo "$NAME."
- ;;
- restart)
- # Restart the postmaster by calling ourselves.
- /etc/init.d/$FILE stop
- sleep 5
- /etc/init.d/$FILE start
- ;;
- status)
- # Print the status of the postmaster.
- su - postgres $DAEMON status
- ;;
- *)
- # Print help.
- N=/etc/init.d/$FILE
- echo "Usage: $N {start|stop|restart|status}" >&2
- exit 1
- ;;
-esac
-
-exit 0
+++ /dev/null
-#!/bin/sh
-#
-# postgres.init Start postgres back end system.
-#
-# Author: Thomas Lockhart
-# modified from other startup files in the RedHat Linux distribution
-#
-# This version can log backend output through syslog using the local5 facility.
-# To enable this, edit /etc/syslog.conf to include a line similar to:
-# local5.* /var/log/postgres
-# and then set USE_SYSLOG to "yes" and FACILITY to "local5" below
-#
-#PGBIN="/opt/postgres/current/bin" # not used any more - thomas 1997-12-14
-PGACCOUNT="postgres" # the postgres account (you called it something else?)
-POSTMASTER="postmaster" # this probably won't change
-
-USE_SOCKET="yes" # "no" to enable tcp/ip(remote) access
-PGSOCKETFILE="/tmp/.s.PGSQL.5432"
-USE_SYSLOG="yes" # "yes" to enable syslog, "no" to go to /tmp/postgres.log
-FACILITY="local5" # can assign local0-local7 as the facility for logging
-PGLOGFILE="/tmp/postgres.log" # only used if syslog is disabled
-
-PGOPTS="" #-B 1024 -S -o '-Fe'
-if [ ${USE_SOCKET} = "no" ]
-then
- PGOPTS="-i ${PGOPTS}" # -i to enable TCP/IP rather than Unix socket
-fi
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-# Get config.
-. /etc/sysconfig/network
-
-# Check that networking is up.
-# Pretty much need it for postmaster.
-if [ ${NETWORKING} = "no" ]
-then
- exit 0
-fi
-
-# Don't bother checking for file existance to avoid hardcoding any paths - thomas 1997-12-14
-#[ -f ${PGBIN}/${POSTMASTER} ] || exit 0
-
-# See how we were called.
-case "$1" in
- start)
-# force a stop to kill a running postmaster and to clean up sockets
-# necessary if system crashed (a power outage provoked this feature)
- eval $0 stop
-# save the old log file, if any
- if [ -f ${PGLOGFILE} ]
- then
- mv ${PGLOGFILE} ${PGLOGFILE}.old
- fi
-
- echo -n "Starting postgres: "
-
-# force full login to get path names
-# my postgres runs tcsh so use proper syntax in redirection...
- if [ ${USE_SYSLOG} = "yes" ]; then
- su - ${PGACCOUNT} -c "(${POSTMASTER} ${PGOPTS} |& logger -p ${FACILITY}.notice) &" > /dev/null&
- else
- su - ${PGACCOUNT} -c "${POSTMASTER} ${PGOPTS} >>&! ${PGLOGFILE} &" > /dev/null&
- fi
- sleep 5
- pid=`pidof ${POSTMASTER}`
- echo -n "${POSTMASTER} [$pid]"
-# touch /var/lock/subsys/${POSTMASTER}
- echo
- ;;
- stop)
- echo -n "Stopping postgres: "
- pid=`pidof ${POSTMASTER}`
- if [ "$pid" != "" ] ; then
- echo -n "${POSTMASTER} [$pid]"
- kill -TERM $pid
- sleep 1
- fi
- if [ ${USE_SOCKET} = "yes" ] && [ -S ${PGSOCKETFILE} ]; then
- echo -n " (remove socket ${PGSOCKETFILE})"
- rm -f ${PGSOCKETFILE}
- fi
- echo
- ;;
- *)
- echo "Usage: $0 {start|stop}"
- exit 1
-esac
-
-exit 0
+++ /dev/null
-#!/bin/sh
-#
-# postgres.init.sh - This script is used to start/stop
-# the postgreSQL listener process.
-#
-# Usage
-#
-# You can use this script manually, and/or you
-# can install this script into the runlevel system
-# by running "sh postgres.init.sh install"
-#
-# Credits
-#
-# Thomas Lockhart
-# modified from other startup files in the
-# RedHat Linux distribution
-#
-# Clark Evans
-# cleaned up, added comments, etc.
-#
-# RedHat Stuff
-#
-# chkconfig: 345 85 15
-# description: Starts and stops the PostgreSQL backend daemon\
-# that handles all database requests.
-# processname: postmaster
-# pidfile: /var/run/postmaster.pid
-#
-#
-# Note
-#
-# This version can log backend output through syslog using
-# the local5 facility. To enable this, set USE_SYSLOG to "yes"
-# below and then edit /etc/syslog.conf to include a line
-# similar to:
-#
-# local5.* /var/log/postgres
-#
-# Config Variables
-#
-PGACCOUNT="postgres"
-#
-# The non-root user account which will be used to run the
-# PostgreSQL executeable. For this script to work, the
-# shell for this account must be SH/BASH.
-#
-# The following lines should be in this account's .bash_profile
-#
-# PATH=$PATH:$HOME/bin
-# MANPATH=$MANPATH:/opt/pgsql/man
-# PGLIB=/opt/pgsql/lib
-# PGDATA=/opt/pgsql/data
-#
-POSTMASTER="postmaster"
-#
-# The executable program which is to be run, in this case
-# it is the listener, which waits for requests on the port
-# specified during configuration.
-#
-USE_SYSLOG="yes"
-#
-# "yes" to enable syslog, "no" to go to /tmp/postgres.log
-#
-FACILITY="local5"
-#
-# can assign local0-local7 as the facility for logging
-#
-PGLOGFILE="/tmp/postgres.log"
-#
-# only used if syslog is disabled
-#
-PGOPTS="" # -B 256
-#
-# The B option sets the number of shared buffers
-#
-# Add the "-i" option to enable TCP/IP sockets in addition
-# to unix domain sockets. This is needed for Java's JDBC
-#
-# PGOPTS="-i"
-#
-# Add the -D option if you want to ovverride the PGDATA
-# environment variable defined in
-#
-# PGOPTS="-D/opt/pgsql/data
-#
-# Add the -p option if you would like the listener to
-# attach to a port other than the one configured (5432?)
-#
-# PGOPTS="-D/opt/pgsql_beta/data -p 5433"
-#
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-# Get config.
-. /etc/sysconfig/network
-
-#
-# Check that networking is up.
-# Pretty much need it for postmaster.
-#
-if [ ${NETWORKING} = "no" ]
-then
- exit 0
-fi
-
-#[ -f /opt/pgsq//bin/postmaster ] || exit 0
-
-#
-# See how we were called.
-#
-case "$1" in
- start)
- if [ -f ${PGLOGFILE} ]
- then
- mv ${PGLOGFILE} ${PGLOGFILE}.old
- fi
- echo -n "Starting postgres: "
-#
-# force full login to get PGDATA and PGLIB path names
-# Since the login script for ${PGACCOUNT} is SH/BASH compliant,
-# we use proper redirection syntax...
-#
- if [ ${USE_SYSLOG} = "yes" ]; then
- su - ${PGACCOUNT} -c "(${POSTMASTER} ${PGOPTS} 2>&1 | logger -p ${FACILITY}.notice) &" > /dev/null 2>&1 &
- else
- su - ${PGACCOUNT} -c "${POSTMASTER} ${PGOPTS} >> ${PGLOGFILE} 2>&1 &" > /dev/null 2>&1 &
- fi
- sleep 5
- pid=`pidof ${POSTMASTER}`
- echo -n "${POSTMASTER} [$pid]"
-# touch /var/lock/subsys/${POSTMASTER}
- echo
- ;;
- stop)
- echo -n "Stopping postgres: "
- pid=`pidof ${POSTMASTER}`
- if [ "$pid" != "" ] ; then
- echo -n "${POSTMASTER} [$pid]"
- kill -TERM $pid
- sleep 1
- fi
- echo
- ;;
- install)
- echo "Adding postgres to runlevel system."
- cp $0 /etc/rc.d/init.d/postgres
- /sbin/chkconfig --add postgres
- echo
- ;;
- uninstall)
- echo "Deleting postgres from runlevel system."
- /sbin/chkconfig --del postgres
- rm /etc/rc.d/init.d/postgres
- echo
- ;;
- *)
- echo "Usage: $0 {start|stop|install|uninstall}"
- exit 1
-esac
-
-exit 0
--- /dev/null
+#! /bin/sh
+
+# This is an example of a start/stop script for SysV-style init, such
+# as is used on Linux systems. You should edit some of the variables
+# and maybe the 'echo' commands.
+#
+# Place this file at /etc/init.d/postgresql (or
+# /etc/rc.d/init.d/postgresql) and make symlinks to
+# /etc/rc.d/rc0.d/K02postgresql
+# /etc/rc.d/rc1.d/K02postgresql
+# /etc/rc.d/rc2.d/K02postgresql
+# /etc/rc.d/rc3.d/S98postgresql
+# /etc/rc.d/rc4.d/S98postgresql
+# /etc/rc.d/rc5.d/S98postgresql
+# Or check out the chkconfig program, if you have it.
+#
+# Proper init scripts on Linux systems normally require setting lock
+# and pid files under /var/run as well as reacting to network
+# settings, so you should treat this with care.
+
+# Original author: Ryan Kirkpatrick
+
+# $Header: /cvsroot/pgsql/contrib/start-scripts/linux,v 1.1 2001/02/08 19:53:33 petere Exp $
+
+## EDIT FROM HERE
+
+# Installation prefix
+prefix=/usr/local/pgsql
+
+# Data directory
+PGDATA="/usr/local/pgsql/data"
+
+# Who to run pg_ctl as, should be "postgres".
+PGUSER=postgres
+
+# Where to keep a log file
+PGLOG="$PGDATA/serverlog"
+
+## STOP EDITING HERE
+
+export PGDATA
+
+# Check for echo -n vs echo \c
+if echo '\c' | grep -s c >/dev/null 2>&1 ; then
+ ECHO_N="echo -n"
+ ECHO_C=""
+else
+ ECHO_N="echo"
+ ECHO_C='\c'
+fi
+
+# The path that is to be used for the script
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+# What to use to start up the postmaster
+DAEMON="$prefix/bin/pg_ctl"
+
+set -e
+
+# Only start if we can find pg_ctl.
+test -f $DAEMON || exit 0
+
+# Parse command line parameters.
+case $1 in
+ start)
+ $ECHO_N "Starting PostgreSQL: "$ECHO_C
+ su - $PGUSER -c "$DAEMON start -s -l $PGLOG"
+ echo "ok"
+ ;;
+ stop)
+ echo -n "Stopping PostgreSQL: "
+ su - $PGUSER -c "$DAEMON stop -s -m fast"
+ echo "ok"
+ ;;
+ restart)
+ echo -n "Restarting PostgreSQL: "
+ su - $PGUSER -c "$DAEMON restart -s -m fast"
+ echo "ok"
+ ;;
+ status)
+ su - $PGUSER -c "$DAEMON status"
+ ;;
+ *)
+ # Print help
+ echo "Usage: $0 {start|stop|restart|status}" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0