- Allow array on int8

- Prevent permissions on indexes
- Instituted --enable-multibyte option and tweaked the MB build process where necessary
- initdb prompts for superuser password
This commit is contained in:
Peter Eisentraut 2000-01-15 18:30:35 +00:00
parent a765db409b
commit 2a1bfbce24
13 changed files with 590 additions and 544 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/initdb.sgml,v 1.6 1999/12/17 01:05:29 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/initdb.sgml,v 1.7 2000/01/15 18:30:27 petere Exp $
Postgres documentation
-->
@ -25,8 +25,8 @@ Postgres documentation
<synopsis>
initdb [ --pgdata|-D <replaceable class="parameter">dbdir</replaceable> ]
[ --sysid|-i <replaceable class="parameter">sysid</replaceable> ]
[ --password|-W <replaceable class="parameter">password</replaceable> ]
[ --pgencoding|-e <replaceable class="parameter">encoding</replaceable> ]
[ --pwprompt|-W ]
[ --encoding|-e <replaceable class="parameter">encoding</replaceable> ]
[ --pglib|-L <replaceable class="parameter">libdir</replaceable> ]
[ --username|-u <replaceable class="parameter">name</replaceable> ]
[ --noclean | -n ] [ --debug | -d ] [ --template | -t ]
@ -71,20 +71,20 @@ initdb [ --pgdata|-D <replaceable class="parameter">dbdir</replaceable> ]
</varlistentry>
<varlistentry>
<term>--password=<replaceable class="parameter">password</replaceable></term>
<term>-W <replaceable class="parameter">password</replaceable></term>
<term>--pwprompt</term>
<term>-W</term>
<listitem>
<para>
Sets the password of the database superuser. If you don't plan
on using password authentication, this is not important. If you
do, you can save yourself a trip by specifying it here, but you
can always change it later. The default password is empty.
Makes initdb prompt for a password of the database superuser. If you
don't plan on using password authentication, this is not important.
Otherwise you won't be able to use password authentication until
you have a password set up.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--pgencoding=<replaceable class="parameter">encoding</replaceable></term>
<term>--encoding=<replaceable class="parameter">encoding</replaceable></term>
<term>-e <replaceable class="parameter">encoding</replaceable></term>
<listitem>
<para>
@ -246,15 +246,6 @@ initdb [ --pgdata|-D <replaceable class="parameter">dbdir</replaceable> ]
it is a good idea to create the data directory before running <application>initdb</application>
<emphasis>and</emphasis> to hand over the ownership of it to the database superuser.
</para>
<para>
Note that if you use the <option>--username</option> you must give correct
information about the name of the <emphasis>current</emphasis> user. If you don't
this will usually manifest itself in an error message about <literal>chmod</literal>
failing on a file <filename>pg_pwd</filename>, because the backend silently
refuses to create it.
</para>
</refsect1>
</refentry>

View File

@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.62 1999/12/13 22:32:15 momjian Exp $
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.63 2000/01/15 18:30:28 petere Exp $
#
# NOTES
# Essentially all Postgres make files include this file and use the
@ -158,14 +158,8 @@ X_CFLAGS= @X_CFLAGS@
X_LIBS= @X_LIBS@
X11_LIBS= -lX11 @X_EXTRA_LIBS@
#
# enable multi-byte support
# choose one of:
# EUC_JP,EUC_CN,EUC_KR,EUC_TW,UNICODE,MULE_INTERNAL,LATIN1-5
# flag whether multibyte is on/off
MULTIBYTE=@MULTIBYTE@
ifdef MULTIBYTE
MBFLAGS = -DMULTIBYTE=$(MULTIBYTE)
endif
##############################################################################
#

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.78 2000/01/14 22:11:35 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.79 2000/01/15 18:30:30 petere Exp $
*
*-------------------------------------------------------------------------
*/
@ -359,21 +359,24 @@ ProcessUtility(Node *parsetree,
aip = stmt->aclitem;
modechg = stmt->modechg;
#ifndef NO_SECURITY
foreach(i, stmt->relNames)
{
{
Relation rel;
relname = strVal(lfirst(i));
rel = heap_openr(relname, AccessExclusiveLock);
if (rel && rel->rd_rel->relkind == RELKIND_INDEX)
elog(ERROR, "\"%s\" is an index relation",
relname);
/* close rel, but keep lock until end of xact */
heap_close(rel, NoLock);
#ifndef NO_SECURITY
if (!pg_ownercheck(userName, relname, RELNAME))
elog(ERROR, "you do not own class \"%s\"",
relname);
}
#endif
foreach(i, stmt->relNames)
{
relname = strVal(lfirst(i));
ChangeAcl(relname, aip, modechg);
}
}
break;

View File

@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.15 1999/12/18 02:48:53 momjian Exp $
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.16 2000/01/15 18:30:31 petere Exp $
#
#-------------------------------------------------------------------------
@ -17,7 +17,7 @@ include ../../Makefile.global
all: initdb
initdb: initdb.sh
sed -e 's/__MULTIBYTE__/$(MULTIBYTE)/' initdb.sh > initdb
sed -e 's/__MULTIBYTE__/$(MULTIBYTE)/g' < initdb.sh > initdb
install: initdb
$(INSTALL) $(INSTL_EXE_OPTS) $+ $(BINDIR)

View File

@ -26,11 +26,12 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.78 2000/01/13 18:22:10 petere Exp $
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.79 2000/01/15 18:30:31 petere Exp $
#
#-------------------------------------------------------------------------
exit_nicely(){
stty echo >& /dev/null
echo
echo "$CMDNAME failed."
if [ "$noclean" -eq 0 ]; then
@ -60,6 +61,18 @@ else
TEMPFILE="/tmp/initdb.$$"
fi
# 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
#
# Find out where we're located
#
@ -98,7 +111,7 @@ done
# 0 is the default (non-)encoding
MULTIBYTEID=0
# This is placed here by configure --with-mb=XXX.
# This is placed here by configure --enable-multibyte[=XXX].
MULTIBYTE=__MULTIBYTE__
# Set defaults:
@ -118,8 +131,6 @@ template_only=0
POSTGRES_SUPERUSERNAME="$EffectiveUser"
POSTGRES_SUPERUSERID="`id -u 2>/dev/null || echo 0`"
Password='_null_'
while [ "$#" -gt 0 ]
do
case "$1" in
@ -160,14 +171,9 @@ do
POSTGRES_SUPERUSERID=`echo $1 | sed 's/^-i//'`
;;
# The default password of the database superuser.
--password|-W)
Password="$2"
shift;;
--password=*)
Password=`echo $1 | sed 's/^--password=//'`
;;
-W*)
Password=`echo $1 | sed 's/^-W//'`
# Make initdb prompt for the default password of the database superuser.
--pwprompt|-W)
PwPrompt=1
;;
# Directory where to install the data. No default, unless the environment
# variable PGDATA is set.
@ -193,43 +199,43 @@ do
;;
# The encoding of the template1 database. Defaults to what you chose
# at configure time. (see above)
--pgencoding|-e)
--encoding|-e)
MULTIBYTE="$2"
shift;;
--pgencoding=*)
MULTIBYTE=`echo $1 | sed 's/^--pgencoding=//'`
--encoding=*)
MULTIBYTE=`echo $1 | sed 's/^--encoding=//'`
;;
-e*)
MULTIBYTE=`echo $1 | sed 's/^-e//'`
;;
*)
echo "Unrecognized option '$1'. Try -? for help."
exit 1
PGDATA=$1
;;
esac
shift
done
if [ "$usage" ]
then
echo ""
echo "Usage: $CMDNAME [options]"
echo ""
echo " -t, --template "
echo " -d, --debug "
echo " -n, --noclean "
echo " -i SYSID, --sysid=SYSID "
echo " -W PASSWORD, --password=PASSWORD "
echo " -u SUPERUSER, --username=SUPERUSER "
echo " -D DATADIR, --pgdata=DATADIR "
echo " -L LIBDIR, --pglib=LIBDIR "
if [ "$usage" ]; then
echo "initdb initialized a PostgreSQL database."
echo
echo "Usage:"
echo " $CMDNAME [options] datadir"
echo
echo "Options:"
echo " [-D, --pgdata] <datadir> Location for this database"
echo " -W, --pwprompt Prompt for a password for the new superuser's"
if [ -n "$MULTIBYTE" ]
then
echo " -e ENCODING, --pgencoding=ENCODING"
echo " -e, --encoding <encoding> Set the default multibyte encoding for new databases"
fi
echo " -?, --help "
echo ""
echo " -i, --sysid <sysid> Database sysid for the superuser"
echo "Less commonly used options: "
echo " -L, --pglib <libdir> Where to find the input files (should happend automatically"
echo " -t, --template Re-initialize template database only"
echo " -d, --debug Generate lots of debugging output"
echo " -n, --noclean Do not clean up after errors"
echo
echo "Report bugs to <bugs@postgresql.org>."
exit 0
fi
@ -239,17 +245,18 @@ fi
if [ "$MULTIBYTE" ]
then
MULTIBYTEID=`$PGPATH/pg_encoding $MULTIBYTE`
MULTIBYTEID=`$PGPATH/pg_encoding $MULTIBYTE 2> /dev/null`
if [ "$?" -ne 0 ]
then
echo "The program pg_encoding failed. Perhaps you did not configure"
echo "PostgreSQL for multibyte support or the program was not success-"
echo "fully installed."
echo "$CMDNAME: pg_encoding failed"
echo
echo "Perhaps you did not configure PostgreSQL for multibyte support or"
echo "the program was not successfully installed."
exit 1
fi
if [ -z "$MULTIBYTEID" ]
then
echo "$CMDNAME: $MULTIBYTE is not a valid encoding name."
echo "$CMDNAME: $MULTIBYTE is not a valid encoding name"
exit 1
fi
fi
@ -273,7 +280,7 @@ fi
if ! echo "$PGDATA" | grep '^/' > /dev/null 2>&1
then
echo "$CMDNAME: The data path must be specified as an absolute path."
echo "$CMDNAME: data path must be specified as an absolute path"
exit 1
fi
@ -284,8 +291,7 @@ fi
# This means they have neither 'id' nor 'whoami'!
if [ -z "$POSTGRES_SUPERUSERNAME" ]
then
echo "$CMDNAME: Could not determine what the name of the database"
echo "superuser should be. Please use the --username option."
echo "$CMDNAME: Could not the determine current username. Please use the -u option."
exit 1
fi
@ -431,7 +437,6 @@ then
cat "$GLOBAL" \
| sed -e "s/POSTGRES/$POSTGRES_SUPERUSERNAME/g" \
-e "s/PGUID/$POSTGRES_SUPERUSERID/g" \
-e "s/PASSWORD/$Password/g" \
| "$PGPATH"/postgres $BACKENDARGS template1 \
|| exit_nicely
@ -470,17 +475,35 @@ echo "CREATE TRIGGER pg_sync_pg_pwd AFTER INSERT OR UPDATE OR DELETE ON pg_shado
"FOR EACH ROW EXECUTE PROCEDURE update_pg_pwd()" \
| "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
# Create the initial pg_pwd (flat-file copy of pg_shadow)
echo "Writing password file."
echo "COPY pg_shadow TO '$PGDATA/pg_pwd' USING DELIMITERS '\\t'" \
# needs to be done before alter user
echo "REVOKE ALL on pg_shadow FROM public" \
| "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
# An ordinary COPY will leave the file too loosely protected.
# Note: If you lied above and specified a --username different from the one
# you really are, this will manifest itself in this command failing because
# of a missing file, since the COPY command above failed. It would perhaps
# be better if postgres returned an error code.
chmod go-rw "$PGDATA"/pg_pwd || exit_nicely
# set up password
if [ "$PwPrompt" ]; then
$ECHO_N "Enter new superuser password: "$ECHO_C
stty -echo >& /dev/null
read FirstPw
stty echo >& /dev/null
echo
$ECHO_N "Enter it again: "$ECHO_C
stty -echo >& /dev/null
read SecondPw
stty echo >& /dev/null
echo
if [ "$FirstPw" != "$SecondPw" ]; then
echo "Passwords didn't match."
exit_nicely
fi
echo "ALTER USER \"$POSTGRES_SUPERUSERNAME\" WITH PASSWORD '$FirstPw'" \
| "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
if [ ! -f $PGDATA/pg_pwd ]; then
echo "The password file wasn't generated. Please report this problem."
exit_nicely
fi
echo "Setting password"
fi
echo "Creating view pg_user."
echo "CREATE VIEW pg_user AS \
@ -496,9 +519,6 @@ echo "CREATE VIEW pg_user AS \
FROM pg_shadow" \
| "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
echo "REVOKE ALL on pg_shadow FROM public" \
| "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
echo "Creating view pg_rules."
echo "CREATE VIEW pg_rules AS \
SELECT \
@ -569,9 +589,9 @@ echo "VACUUM ANALYZE" \
echo
echo "$CMDNAME completed successfully. You can now start the database server."
echo "($PGPATH/postmaster -D $PGDATA)"
echo " $PGPATH/postmaster -D $PGDATA"
echo "or"
echo "($PGPATH/pg_ctl -D $PGDATA start)"
echo " $PGPATH/pg_ctl -D $PGDATA start"
echo
exit 0

View File

@ -6,21 +6,28 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/Makefile,v 1.3 1999/06/05 10:27:31 ishii Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/Makefile,v 1.4 2000/01/15 18:30:32 petere Exp $
#
#-------------------------------------------------------------------------
SRCDIR= ../..
include ../../Makefile.global
# This is a bit of hackery here: pg_encoding uses backend includes and the
# frontend library.
OBJS= pg_encoding.o
CFLAGS:= -I$(SRCDIR)/include $(CFLAGS)
CFLAGS+= $(MBFLAGS) -I$(SRCDIR)/include
all: submake pg_encoding
all: pg_encoding
pg_encoding: $(OBJS)
$(CC) -o pg_encoding $(OBJS) -L$(LIBPQDIR) -lpq $(LDFLAGS) $(CFLAGS)
pg_encoding: $(OBJS) $(LIBPQDIR)/libpq.a
$(CC) -o pg_encoding $(OBJS) -L$(LIBPQDIR) -lpq $(LDFLAGS)
.PHONY: submake
submake:
$(MAKE) -C $(LIBPQDIR) libpq.a
install: pg_encoding
$(INSTALL) $(INSTL_EXE_OPTS) pg_encoding$(X) $(BINDIR)/pg_encoding$(X)

View File

@ -7,11 +7,11 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/pg_encoding.c,v 1.5 1999/12/16 20:10:00 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/pg_encoding.c,v 1.6 2000/01/15 18:30:32 petere Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "c.h"
#include "mb/pg_wchar.h"
static void usage(void);

862
src/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -214,7 +214,7 @@ dnl We have read the default value of USE_LOCALE from the template
dnl file. We have a further option of using
dnl --enable-locale to explicitly enable it
dnl It defaults to disabled
AC_MSG_CHECKING(setting USE_LOCALE)
AC_MSG_CHECKING(whether to support locale)
AC_ARG_ENABLE(
locale,
[ --enable-locale enable locale support ],
@ -225,7 +225,7 @@ AC_ARG_ENABLE(
dnl We exclude cyrillic recode support unless we override it with
dnl --enable-recode to explicitly enable it
dnl It defaults to disabled
AC_MSG_CHECKING(setting CYR_RECODE)
AC_MSG_CHECKING(whether to support cyrillic recode)
AC_ARG_ENABLE(
recode,
[ --enable-recode enable cyrillic recode support ],
@ -233,23 +233,36 @@ AC_ARG_ENABLE(
AC_MSG_RESULT(disabled)
)
AC_MSG_CHECKING(setting MULTIBYTE)
AC_ARG_WITH(mb,
[ --with-mb=<encoding> enable multi-byte support ],
dnl Multibyte support
AC_MSG_CHECKING(whether to support multibyte)
AC_ARG_ENABLE(multibyte,
[ --enable-multibyte enable multibyte character support ],
[
case "$withval" in
SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
AC_MSG_RESULT("enabled with $withval")
;;
*)
AC_MSG_ERROR([*** You must supply an argument to the --with-mb option one of SQL_ASCII,EUC_JP,EUC_CN,EUC_KR,EUC_TW,UNICODE,MULE_INTERNAL,LATIN1-5,KOI8,WIN,ALT])
;;
esac
MULTIBYTE="$withval"
MULTIBYTE=SQL_ASCII
if test "$enableval" != "yes"; then
case "$enableval" in
SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT|SJIS|BIG5|WIN1250)
# ok
;;
*)
AC_MSG_ERROR(
[Argument to --enable-multibyte must be one of:
SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW,
UNICODE, MULE_INTERNAL,
LATIN1, LATIN2, LATIN3, LATIN4, LATIN5,
KOI8, WIN, ALT, SJIS, BIG5, WIN1250
Or do not specify an argument to the option to use the default.])
esac
MULTIBYTE=$enableval
fi
AC_DEFINE(MULTIBYTE)
AC_MSG_RESULT(enabled)
],
AC_MSG_RESULT("disabled")
)
dnl We use the default value of 5432 for the DEF_PGPORT value. If
dnl we over-ride it with --with-pgport=port then we bypass this piece
AC_MSG_CHECKING(setting DEF_PGPORT)

View File

@ -8,7 +8,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_shadow.h,v 1.5 1999/12/17 01:05:31 momjian Exp $
* $Id: pg_shadow.h,v 1.6 2000/01/15 18:30:34 petere Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -72,6 +72,6 @@ typedef FormData_pg_shadow *Form_pg_shadow;
* user choices.
* ----------------
*/
DATA(insert OID = 0 ( POSTGRES PGUID t t t t PASSWORD _null_ ));
DATA(insert OID = 0 ( POSTGRES PGUID t t t t _null_ _null_ ));
#endif /* PG_SHADOW_H */

View File

@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_type.h,v 1.75 2000/01/11 04:02:28 tgl Exp $
* $Id: pg_type.h,v 1.76 2000/01/15 18:30:34 petere Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -328,6 +328,7 @@ DATA(insert OID = 1012 ( _cid PGUID -1 -1 f b t \054 0 29 array_in array_out
DATA(insert OID = 1013 ( _oidvector PGUID -1 -1 f b t \054 0 30 array_in array_out array_in array_out i _null_ ));
DATA(insert OID = 1014 ( _bpchar PGUID -1 -1 f b t \054 0 1042 array_in array_out array_in array_out i _null_ ));
DATA(insert OID = 1015 ( _varchar PGUID -1 -1 f b t \054 0 1043 array_in array_out array_in array_out i _null_ ));
DATA(insert OID = 1016 ( _int8 PGUID -1 -1 f b t \054 0 20 array_in array_out array_in array_out d _null_ ));
DATA(insert OID = 1017 ( _point PGUID -1 -1 f b t \054 0 600 array_in array_out array_in array_out d _null_ ));
DATA(insert OID = 1018 ( _lseg PGUID -1 -1 f b t \054 0 601 array_in array_out array_in array_out d _null_ ));
DATA(insert OID = 1019 ( _path PGUID -1 -1 f b t \054 0 602 array_in array_out array_in array_out d _null_ ));

View File

@ -61,6 +61,9 @@
/* Set to 1 if you want CYR_RECODE (cyrillic recode) */
#undef CYR_RECODE
/* Set to 1 if you want to use multibyte characters */
#undef MULTIBYTE
/* Set to 1 if you want to Enable ASSERT CHECKING */
#undef USE_ASSERT_CHECKING

View File

@ -1,10 +1,10 @@
/* $Id: pg_wchar.h,v 1.11 1999/07/17 16:25:28 momjian Exp $ */
/* $Id: pg_wchar.h,v 1.12 2000/01/15 18:30:35 petere Exp $ */
#ifndef PG_WCHAR_H
#define PG_WCHAR_H
#include "postgres.h"
#include <sys/types.h>
#include "c.h"
#define SQL_ASCII 0 /* SQL/ASCII */
#define EUC_JP 1 /* EUC for Japanese */