mirror of https://github.com/postgres/postgres
Version number now set in configure, available through Makefile.global
and config.h. Adjusted all referring code. Scrapped pg_version and changed initdb accordingly. Integrated src/utils/version.c into src/backend/utils/init/miscinit.c. Changed all callers. Set version number to `7.1devel'. (Non-numeric version suffixes now allowed.)
This commit is contained in:
parent
07dfe97731
commit
6fb9d2e347
15
configure.in
15
configure.in
|
@ -6,6 +6,10 @@ AC_CONFIG_HEADER(src/include/config.h)
|
|||
AC_PREREQ(2.13)
|
||||
AC_CONFIG_AUX_DIR(`pwd`/config)
|
||||
|
||||
VERSION='7.1devel'
|
||||
AC_SUBST(VERSION)
|
||||
AC_DEFINE_UNQUOTED(PG_VERSION, "$VERSION")
|
||||
|
||||
mkinstalldirs="\$(SHELL) \$(top_srcdir)/config/mkinstalldirs"
|
||||
AC_SUBST(mkinstalldirs)
|
||||
|
||||
|
@ -309,13 +313,13 @@ AC_PROG_CPP
|
|||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_SUBST(GCC)
|
||||
|
||||
if test "$CC" = "gcc"
|
||||
then
|
||||
CC_VERSION=`${CC} --version`
|
||||
if test x"$GCC" = x"yes" ; then
|
||||
cc_string="GCC `${CC} --version`"
|
||||
else
|
||||
CC_VERSION=""
|
||||
cc_string=$CC
|
||||
fi
|
||||
AC_SUBST(CC_VERSION)
|
||||
AC_DEFINE_UNQUOTED(PG_VERSION_STR, ["PostgreSQL $VERSION on $host, compiled by $cc_string"], [A canonical string containing the version number, platform, and C compiler])
|
||||
|
||||
|
||||
|
||||
dnl We exclude tcl support unless user says --with-tcl
|
||||
|
@ -1198,6 +1202,5 @@ AC_OUTPUT(
|
|||
src/Makefile.global
|
||||
src/backend/port/Makefile
|
||||
src/backend/catalog/genbki.sh
|
||||
src/include/version.h
|
||||
src/test/regress/GNUmakefile
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/Attic/GNUmakefile.in,v 1.55 2000/07/01 21:16:42 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/Attic/GNUmakefile.in,v 1.56 2000/07/02 15:20:41 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
@ -24,14 +24,12 @@ ETAGS = @etags@
|
|||
XARGS = @xargs@
|
||||
|
||||
all:
|
||||
$(MAKE) -C utils all
|
||||
$(MAKE) -C backend all
|
||||
$(MAKE) -C interfaces all
|
||||
$(MAKE) -C bin all
|
||||
$(MAKE) -C pl all
|
||||
|
||||
install: installdirs
|
||||
$(MAKE) -C utils install
|
||||
$(MAKE) -C backend install
|
||||
$(MAKE) -C interfaces install
|
||||
$(MAKE) -C bin install
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.84 2000/07/01 21:16:42 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.85 2000/07/02 15:20:41 petere Exp $
|
||||
#
|
||||
# NOTES
|
||||
# Essentially all Postgres make files include this file and use the
|
||||
|
@ -35,6 +35,9 @@
|
|||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# PostgreSQL version number
|
||||
VERSION = @VERSION@
|
||||
|
||||
ifndef SRCDIR
|
||||
# This should be changed once we have separate build dirs.
|
||||
top_srcdir = $(top_builddir)
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.56 2000/06/28 03:30:57 tgl Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.57 2000/07/02 15:20:44 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
@ -57,10 +57,8 @@ ifeq ($(PORTNAME), qnx4)
|
|||
OBJS+= bootstrap/bootstrap.o
|
||||
endif
|
||||
|
||||
VERSIONOBJ = $(SRCDIR)/utils/version.o
|
||||
|
||||
ifeq ($(MAKE_DLL), true)
|
||||
DLLOBJS= $(OBJS) $(VERSIONOBJ)
|
||||
DLLOBJS= $(OBJS)
|
||||
DLLLIBS= -L/usr/local/lib -lcygipc -lcrypt -lcygwin -lkernel32
|
||||
|
||||
postgres.def: $(DLLOBJS)
|
||||
|
@ -74,8 +72,8 @@ all: prebuildheaders postgres $(POSTGRES_IMP)
|
|||
|
||||
ifneq ($(PORTNAME), win)
|
||||
|
||||
postgres: $(OBJS) $(VERSIONOBJ)
|
||||
$(CC) $(CFLAGS) -o postgres $(OBJS) $(VERSIONOBJ) $(LDFLAGS)
|
||||
postgres: $(OBJS)
|
||||
$(CC) $(CFLAGS) -o postgres $(OBJS) $(LDFLAGS)
|
||||
|
||||
else
|
||||
|
||||
|
@ -93,9 +91,6 @@ $(OBJS): $(DIRS:%=%.dir)
|
|||
$(DIRS:%=%.dir):
|
||||
$(MAKE) -C $(subst .dir,,$@) all
|
||||
|
||||
$(VERSIONOBJ): $(SRCDIR)/utils/version.c $(SRCDIR)/include/version.h
|
||||
$(MAKE) -C $(SRCDIR)/utils version.o
|
||||
|
||||
$(SRCDIR)/utils/dllinit.o: $(SRCDIR)/utils/dllinit.c
|
||||
$(MAKE) -C $(SRCDIR)/utils dllinit.o
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.150 2000/06/28 03:31:52 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.151 2000/07/02 15:20:48 petere Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
|
@ -84,7 +84,6 @@
|
|||
#include "access/xlog.h"
|
||||
#include "tcop/tcopprot.h"
|
||||
#include "utils/guc.h"
|
||||
#include "version.h"
|
||||
|
||||
/*
|
||||
* "postmaster.opts" is a file containing options for postmaser.
|
||||
|
@ -300,8 +299,11 @@ int assert_enabled = 1;
|
|||
#endif
|
||||
|
||||
static void
|
||||
checkDataDir(const char *DataDir, bool *DataDirOK)
|
||||
checkDataDir(const char *DataDir)
|
||||
{
|
||||
char path[MAXPGPATH];
|
||||
FILE *fp;
|
||||
|
||||
if (DataDir == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s does not know where to find the database system "
|
||||
|
@ -309,59 +311,35 @@ checkDataDir(const char *DataDir, bool *DataDirOK)
|
|||
"database system either by specifying the -D invocation "
|
||||
"option or by setting the PGDATA environment variable.\n\n",
|
||||
progname);
|
||||
*DataDirOK = false;
|
||||
exit(2);
|
||||
}
|
||||
else
|
||||
|
||||
snprintf(path, sizeof(path), "%s%cbase%ctemplate1%cpg_class",
|
||||
DataDir, SEP_CHAR, SEP_CHAR, SEP_CHAR);
|
||||
|
||||
fp = AllocateFile(path, PG_BINARY_R);
|
||||
if (fp == NULL)
|
||||
{
|
||||
char path[MAXPGPATH];
|
||||
FILE *fp;
|
||||
|
||||
snprintf(path, sizeof(path), "%s%cbase%ctemplate1%cpg_class",
|
||||
DataDir, SEP_CHAR, SEP_CHAR, SEP_CHAR);
|
||||
fp = AllocateFile(path, PG_BINARY_R);
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s does not find the database system. "
|
||||
"Expected to find it "
|
||||
"in the PGDATA directory \"%s\", but unable to open file "
|
||||
"with pathname \"%s\".\n\n",
|
||||
progname, DataDir, path);
|
||||
*DataDirOK = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *reason;
|
||||
|
||||
/* reason ValidatePgVersion failed. NULL if didn't */
|
||||
|
||||
FreeFile(fp);
|
||||
|
||||
ValidatePgVersion(DataDir, &reason);
|
||||
if (reason)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Database system in directory %s "
|
||||
"is not compatible with this version of "
|
||||
"Postgres, or we are unable to read the "
|
||||
"PG_VERSION file. "
|
||||
"Explanation from ValidatePgVersion: %s\n\n",
|
||||
DataDir, reason);
|
||||
free(reason);
|
||||
*DataDirOK = false;
|
||||
}
|
||||
else
|
||||
*DataDirOK = true;
|
||||
}
|
||||
fprintf(stderr, "%s does not find the database system. "
|
||||
"Expected to find it "
|
||||
"in the PGDATA directory \"%s\", but unable to open file "
|
||||
"with pathname \"%s\".\n\n",
|
||||
progname, DataDir, path);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
FreeFile(fp);
|
||||
|
||||
ValidatePgVersion(DataDir);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
PostmasterMain(int argc, char *argv[])
|
||||
{
|
||||
int opt;
|
||||
int status;
|
||||
int silentflag = 0;
|
||||
bool DataDirOK; /* We have a usable PGDATA value */
|
||||
char original_extraoptions[MAXPGPATH];
|
||||
|
||||
IsUnderPostmaster = true; /* so that backends know this */
|
||||
|
@ -435,12 +413,7 @@ PostmasterMain(int argc, char *argv[])
|
|||
}
|
||||
|
||||
optind = 1; /* start over */
|
||||
checkDataDir(DataDir, &DataDirOK); /* issues error messages */
|
||||
if (!DataDirOK)
|
||||
{
|
||||
fprintf(stderr, "No data directory -- can't proceed.\n");
|
||||
exit(2);
|
||||
}
|
||||
checkDataDir(DataDir); /* issues error messages */
|
||||
|
||||
ProcessConfigFile(PGC_POSTMASTER);
|
||||
|
||||
|
|
|
@ -5,14 +5,13 @@
|
|||
*
|
||||
* IDENTIFICATION
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/version.c,v 1.9 1999/07/17 20:18:00 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/version.c,v 1.10 2000/07/02 15:20:51 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "postgres.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
text *version(void);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.50 2000/06/14 18:17:46 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.51 2000/07/02 15:20:56 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -24,6 +24,7 @@
|
|||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/pg_shadow.h"
|
||||
|
@ -520,3 +521,51 @@ SetPidFile(pid_t pid)
|
|||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Determine whether the PG_VERSION file in directory `path' indicates
|
||||
* a data version compatible with the version of this program.
|
||||
*
|
||||
* If compatible, return. Otherwise, elog(FATAL).
|
||||
*/
|
||||
void
|
||||
ValidatePgVersion(const char *path)
|
||||
{
|
||||
char full_path[MAXPGPATH];
|
||||
FILE *file;
|
||||
int ret;
|
||||
long file_major, file_minor;
|
||||
long my_major = 0, my_minor = 0;
|
||||
char *endptr;
|
||||
const char *version_string = PG_VERSION;
|
||||
|
||||
my_major = strtol(version_string, &endptr, 10);
|
||||
if (*endptr == '.')
|
||||
my_minor = strtol(endptr+1, NULL, 10);
|
||||
|
||||
snprintf(full_path, MAXPGPATH, "%s/PG_VERSION", path);
|
||||
|
||||
file = AllocateFile(full_path, "r");
|
||||
if (!file)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
elog(FATAL, "File %s is missing. This is not a valid data directory.", full_path);
|
||||
else
|
||||
elog(FATAL, "cannot open %s: %s", full_path, strerror(errno));
|
||||
}
|
||||
|
||||
ret = fscanf(file, "%ld.%ld", &file_major, &file_minor);
|
||||
if (ret == EOF)
|
||||
elog(FATAL, "cannot read %s: %s", full_path, strerror(errno));
|
||||
else if (ret != 2)
|
||||
elog(FATAL, "`%s' does not have a valid format. You need to initdb.", full_path);
|
||||
|
||||
FreeFile(file);
|
||||
|
||||
if (my_major != file_major || my_minor != file_minor)
|
||||
elog(FATAL, "The data directory was initalized by PostgreSQL version %ld.%ld, "
|
||||
"which is not compatible with this verion %s.",
|
||||
file_major, file_minor, version_string);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.60 2000/06/28 03:32:43 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.61 2000/07/02 15:20:56 petere Exp $
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
|
@ -34,7 +34,6 @@
|
|||
#include "utils/portal.h"
|
||||
#include "utils/relcache.h"
|
||||
#include "utils/syscache.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
#include "mb/pg_wchar.h"
|
||||
|
@ -267,9 +266,7 @@ InitPostgres(const char *dbname)
|
|||
elog(FATAL, "Database system not found. Data directory '%s' does not exist.",
|
||||
DataDir);
|
||||
|
||||
ValidatePgVersion(DataDir, &reason);
|
||||
if (reason != NULL)
|
||||
elog(FATAL, reason);
|
||||
ValidatePgVersion(DataDir);
|
||||
|
||||
/*-----------------
|
||||
* Find oid and path of the database we're about to open. Since we're
|
||||
|
@ -300,9 +297,7 @@ InitPostgres(const char *dbname)
|
|||
elog(FATAL, "Database \"%s\" does not exist. The data directory '%s' is missing.",
|
||||
dbname, fullpath);
|
||||
|
||||
ValidatePgVersion(fullpath, &reason);
|
||||
if (reason != NULL)
|
||||
elog(FATAL, "%s", reason);
|
||||
ValidatePgVersion(fullpath);
|
||||
|
||||
if (chdir(fullpath) == -1)
|
||||
elog(FATAL, "Unable to change directory to '%s': %s", fullpath, strerror(errno));
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.27 2000/07/01 15:02:19 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.28 2000/07/02 15:20:56 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
@ -13,7 +13,7 @@ top_builddir = ../..
|
|||
include ../Makefile.global
|
||||
|
||||
DIRS := initdb initlocation ipcclean pg_ctl pg_dump pg_id \
|
||||
pg_passwd pg_version psql scripts
|
||||
pg_passwd psql scripts
|
||||
|
||||
ifdef MULTIBYTE
|
||||
DIRS += pg_encoding
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.18 2000/06/27 00:30:53 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.19 2000/07/02 15:21:00 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
@ -14,8 +14,8 @@ include ../../Makefile.global
|
|||
|
||||
all: initdb
|
||||
|
||||
initdb: initdb.sh
|
||||
sed -e 's/__MULTIBYTE__/$(MULTIBYTE)/g' < $< > $@
|
||||
initdb: initdb.sh ../../Makefile.global
|
||||
sed -e 's/__MULTIBYTE__/$(MULTIBYTE)/g' -e 's/__VERSION__/$(VERSION)/g' < $< > $@
|
||||
|
||||
install: all installdirs
|
||||
$(INSTALL_SCRIPT) initdb $(bindir)/initdb
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.97 2000/06/22 22:31:22 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.98 2000/07/02 15:21:00 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
@ -88,7 +88,7 @@ else
|
|||
fi
|
||||
|
||||
# Check if needed programs actually exist in path
|
||||
for prog in postgres pg_version pg_id
|
||||
for prog in postgres pg_id
|
||||
do
|
||||
if [ ! -x "$PGPATH/$prog" ]
|
||||
then
|
||||
|
@ -117,6 +117,13 @@ then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Replaced at build time
|
||||
VERSION=__VERSION__
|
||||
short_version=`echo $VERSION | sed -e 's!^\([0-9][0-9]*\.[0-9][0-9]*\).*!\1!'`
|
||||
if [ x"$short_version" = x"" ] ; then
|
||||
echo "$CMDNAME: bug: version number is out of format"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 0 is the default (non-)encoding
|
||||
MULTIBYTEID=0
|
||||
|
@ -144,6 +151,10 @@ do
|
|||
usage=t
|
||||
break
|
||||
;;
|
||||
--version)
|
||||
echo "initdb (PostgreSQL) $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
--debug|-d)
|
||||
debug=1
|
||||
echo "Running with debug mode on."
|
||||
|
@ -439,7 +450,7 @@ cat "$TEMPLATE" \
|
|||
| "$PGPATH"/postgres $FIRSTRUN template1 \
|
||||
|| exit_nicely
|
||||
|
||||
"$PGPATH"/pg_version "$PGDATA"/base/template1 || exit_nicely
|
||||
echo $short_version > "$PGDATA"/base/template1/PG_VERSION || exit_nicely
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Create the global classes, if requested.
|
||||
|
@ -456,7 +467,7 @@ then
|
|||
| "$PGPATH"/postgres $BACKENDARGS template1 \
|
||||
|| exit_nicely
|
||||
|
||||
"$PGPATH"/pg_version "$PGDATA" || exit_nicely
|
||||
echo $short_version > "$PGDATA/PG_VERSION" || exit_nicely
|
||||
|
||||
cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf || exit_nicely
|
||||
cp "$POSTGRESQL_CONF_SAMPLE" "$PGDATA"/postgresql.conf || exit_nicely
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.152 2000/06/14 18:17:50 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.153 2000/07/02 15:21:05 petere Exp $
|
||||
*
|
||||
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
|
||||
*
|
||||
|
@ -70,7 +70,6 @@
|
|||
#include "catalog/pg_language.h"
|
||||
#include "catalog/pg_trigger.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "libpq-fe.h"
|
||||
#ifndef HAVE_STRDUP
|
||||
|
@ -177,7 +176,7 @@ help(const char *progname)
|
|||
static void
|
||||
version(void)
|
||||
{
|
||||
puts("pg_dump (PostgreSQL) " PG_RELEASE "." PG_VERSION "." PG_SUBVERSION);
|
||||
puts("pg_dump (PostgreSQL) " PG_VERSION);
|
||||
puts("Portions Copyright (c) 1996-2000, PostgreSQL, Inc");
|
||||
puts("Portions Copyright (C) 1996 Regents of the University of California");
|
||||
puts("Read the file COPYRIGHT to see the usage and distribution terms.");
|
||||
|
@ -541,10 +540,11 @@ static void
|
|||
check_database_version(bool ignoreVersion)
|
||||
{
|
||||
PGresult *res;
|
||||
const char *dbversion;
|
||||
const char *myversion = "PostgreSQL " PG_RELEASE "." PG_VERSION;
|
||||
int myversionlen = strlen(myversion);
|
||||
double myversion;
|
||||
const char *remoteversion_str;
|
||||
double remoteversion;
|
||||
|
||||
myversion = strtod(PG_VERSION, NULL);
|
||||
res = PQexec(g_conn, "SELECT version()");
|
||||
if (!res ||
|
||||
PQresultStatus(res) != PGRES_TUPLES_OK ||
|
||||
|
@ -553,11 +553,13 @@ check_database_version(bool ignoreVersion)
|
|||
fprintf(stderr, "check_database_version(): command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn));
|
||||
exit_nicely(g_conn);
|
||||
}
|
||||
dbversion = PQgetvalue(res, 0, 0);
|
||||
if (strncmp(dbversion, myversion, myversionlen) != 0)
|
||||
|
||||
remoteversion_str = PQgetvalue(res, 0, 0);
|
||||
remoteversion = strtod(remoteversion_str + 11, NULL);
|
||||
if (myversion != remoteversion)
|
||||
{
|
||||
fprintf(stderr, "Database version: %s\npg_dump version: %s\n",
|
||||
dbversion, PG_RELEASE "." PG_VERSION);
|
||||
remoteversion_str, PG_VERSION);
|
||||
if (ignoreVersion)
|
||||
fprintf(stderr, "Proceeding despite version mismatch.\n");
|
||||
else
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile for src/bin/pg_version
|
||||
#
|
||||
# Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
# Portions Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/Makefile,v 1.7 2000/06/27 00:31:29 petere Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
subdir = src/bin/pg_version
|
||||
top_builddir = ../../..
|
||||
include ../../Makefile.global
|
||||
|
||||
OBJS= pg_version.o $(top_builddir)/src/utils/version.o $(STRERROR2)
|
||||
|
||||
all: pg_version$(X)
|
||||
|
||||
pg_version$(X): $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
$(top_builddir)/src/utils/version.o: $(top_srcdir)/src/utils/version.c $(top_builddir)/src/include/version.h
|
||||
$(MAKE) -C $(top_builddir)/src/utils version.o
|
||||
|
||||
install: all installdirs
|
||||
$(INSTALL_PROGRAM) pg_version$(X) $(bindir)/pg_version$(X)
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(bindir)
|
||||
|
||||
uninstall:
|
||||
rm -f $(bindir)/pg_version$(X)
|
||||
|
||||
depend dep:
|
||||
$(CC) -MM $(CFLAGS) *.c >depend
|
||||
|
||||
clean distclean maintainer-clean:
|
||||
rm -f pg_version$(X) pg_version.o
|
||||
|
||||
ifeq (depend,$(wildcard depend))
|
||||
include depend
|
||||
endif
|
|
@ -1,46 +0,0 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* pg_version.c
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/pg_version.c,v 1.12 2000/01/26 05:57:40 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "version.h" /* interface to SetPgVersion */
|
||||
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int retcode; /* our eventual return code */
|
||||
char *reason; /* Reason that SetPgVersion failed, NULL
|
||||
* if it didn't. */
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf(stderr, "pg_version: missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
SetPgVersion(argv[1], &reason);
|
||||
if (reason)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"pg_version is unable to create the PG_VERSION file. "
|
||||
"SetPgVersion gave this reason: %s\n",
|
||||
reason);
|
||||
retcode = 10;
|
||||
}
|
||||
else
|
||||
retcode = 0;
|
||||
return retcode;
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright 2000 by PostgreSQL Global Development Group
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.20 2000/04/12 17:16:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.21 2000/07/02 15:21:17 petere Exp $
|
||||
*/
|
||||
#include "postgres.h"
|
||||
#include "common.h"
|
||||
|
@ -28,7 +28,6 @@
|
|||
#include "libpq-fe.h"
|
||||
#include "postgres_ext.h"
|
||||
#include "pqsignal.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "settings.h"
|
||||
#include "variables.h"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright 2000 by PostgreSQL Global Development Group
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.33 2000/05/14 18:05:05 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.34 2000/07/02 15:21:17 petere Exp $
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
|||
#endif
|
||||
|
||||
#include "libpq-fe.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "command.h"
|
||||
#include "common.h"
|
||||
|
@ -580,7 +579,7 @@ process_psqlrc(void)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sprintf(psqlrc, "%s/.psqlrc-" PG_RELEASE "." PG_VERSION "." PG_SUBVERSION, home);
|
||||
sprintf(psqlrc, "%s/.psqlrc-" PG_VERSION, home);
|
||||
if (access(psqlrc, R_OK) == 0)
|
||||
process_file(psqlrc);
|
||||
else
|
||||
|
@ -602,7 +601,7 @@ process_psqlrc(void)
|
|||
static void
|
||||
showVersion(void)
|
||||
{
|
||||
puts("psql (PostgreSQL) " PG_RELEASE "." PG_VERSION "." PG_SUBVERSION);
|
||||
puts("psql (PostgreSQL) " PG_VERSION);
|
||||
|
||||
#if defined(USE_READLINE) || defined (USE_HISTORY) || defined(MULTIBYTE)
|
||||
fputs("contains ", stdout);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* or in config.h afterwards. Of course, if you edit config.h, then your
|
||||
* changes will be overwritten the next time you run configure.
|
||||
*
|
||||
* $Id: config.h.in,v 1.121 2000/06/29 05:50:29 tgl Exp $
|
||||
* $Id: config.h.in,v 1.122 2000/07/02 15:21:18 petere Exp $
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
|
@ -28,6 +28,11 @@
|
|||
*------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* The version number is actually hard-coded into configure.in */
|
||||
#undef PG_VERSION
|
||||
/* A canonical string containing the version number, platform, and C compiler */
|
||||
#undef PG_VERSION_STR
|
||||
|
||||
/* Set to 1 if you want LOCALE support (--enable-locale) */
|
||||
#undef USE_LOCALE
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: miscadmin.h,v 1.61 2000/06/28 03:32:56 tgl Exp $
|
||||
* $Id: miscadmin.h,v 1.62 2000/07/02 15:21:18 petere Exp $
|
||||
*
|
||||
* NOTES
|
||||
* some of the information in this file will be moved to
|
||||
|
@ -227,4 +227,7 @@ extern void SetPidFname(char *datadir);
|
|||
extern void UnlinkPidFile(void);
|
||||
extern int SetPidFile(pid_t pid);
|
||||
|
||||
|
||||
extern void ValidatePgVersion(const char *path);
|
||||
|
||||
#endif /* MISCADMIN_H */
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* version.h.in
|
||||
* this file contains the interface to version.c.
|
||||
* Also some parameters.
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/include/Attic/version.h.in,v 1.9 2000/06/12 22:36:10 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
void ValidatePgVersion(const char *path, char **reason_p);
|
||||
void SetPgVersion(const char *path, char **reason_p);
|
||||
|
||||
#define PG_RELEASE "7"
|
||||
#define PG_VERSION "1"
|
||||
#define PG_SUBVERSION "0"
|
||||
|
||||
#define PG_VERFILE "PG_VERSION"
|
||||
|
||||
#define PG_VERSION_STR "PostgreSQL " PG_RELEASE "." PG_VERSION "." PG_SUBVERSION " on @host@, compiled by @CC@ @CC_VERSION@"
|
||||
|
||||
#endif
|
|
@ -1,9 +1,9 @@
|
|||
update version number in configure.in
|
||||
README
|
||||
HISTORY
|
||||
register.txt
|
||||
doc/Machine-specific FAQ's
|
||||
doc/bug.template
|
||||
update include/version.h.in after release, including subversion
|
||||
update pgaccess
|
||||
update src/interfaces/jdbc/postgresql/jdbc1/DatabaseMetaData.java
|
||||
update src/interfaces/jdbc/postgresql/jdbc2/DatabaseMetaData.java
|
||||
|
@ -13,7 +13,6 @@ update doc/src/sgml/install.sgml
|
|||
update interfaces/libpq/libpq.rc
|
||||
update documentation
|
||||
command-line arg printout from inside the program
|
||||
psql help in psqlHelp.c
|
||||
man pages
|
||||
sgml docs
|
||||
update VERSION numbers of interfaces
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile--
|
||||
# Makefile for utils
|
||||
# Makefile for utils
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/utils/Attic/Makefile,v 1.7 2000/02/27 01:18:46 tgl Exp $
|
||||
# $Header: /cvsroot/pgsql/src/utils/Attic/Makefile,v 1.8 2000/07/02 15:21:27 petere Exp $
|
||||
#
|
||||
# About strdup: Some systems have strdup in their standard library, others
|
||||
# don't. Ones that don't will use this make file to compile the strdup.c
|
||||
|
@ -19,24 +17,18 @@
|
|||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
SRCDIR = ..
|
||||
include $(SRCDIR)/Makefile.global
|
||||
subdir = src/utils
|
||||
top_builddir = ../..
|
||||
include ../Makefile.global
|
||||
|
||||
all: version.o
|
||||
all:
|
||||
|
||||
install:
|
||||
clean distclean maintainer-clean:
|
||||
rm -f dllinit.o getopt.o strdup.o
|
||||
|
||||
depend dep:
|
||||
$(CC) $(CFLAGS) -MM *.c >depend
|
||||
|
||||
clean:
|
||||
rm -f dllinit.o getopt.o strdup.o version.o
|
||||
|
||||
# Make sure version.o has proper dependency on version.h,
|
||||
# even if we didn't do make depend.
|
||||
version.o: version.c $(SRCDIR)/include/version.h
|
||||
|
||||
ifeq (depend,$(wildcard depend))
|
||||
include depend
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,149 +0,0 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* version.c
|
||||
* Routines to handle Postgres version number.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/utils/Attic/version.c,v 1.17 2000/06/14 18:18:01 petere Exp $
|
||||
*
|
||||
* STANDALONE CODE - do not use error routines as this code is not linked
|
||||
* with any...
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <fcntl.h> /* For open() flags */
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "storage/fd.h" /* for O_ */
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
static void
|
||||
PathSetVersionFilePath(const char *path, char *filepathbuf)
|
||||
{
|
||||
/*----------------------------------------------------------------------------
|
||||
PathSetVersionFilePath
|
||||
|
||||
Destructively change "filepathbuf" to contain the concatenation of "path"
|
||||
and the name of the version file name.
|
||||
----------------------------------------------------------------------------*/
|
||||
if ((strlen(path) + 1 + strlen(PG_VERFILE)) >= MAXPGPATH)
|
||||
*filepathbuf = '\0';
|
||||
else
|
||||
sprintf(filepathbuf, "%s%c%s", path, SEP_CHAR, PG_VERFILE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
ValidatePgVersion(const char *path, char **reason_p)
|
||||
{
|
||||
/*----------------------------------------------------------------------------
|
||||
Determine whether the PG_VERSION file in directory <path> indicates
|
||||
a data version compatible with the version of this program.
|
||||
|
||||
If compatible, return <*reason_p> == NULL. Otherwise, malloc space,
|
||||
fill it with a text string explaining how it isn't compatible (or why
|
||||
we can't tell), and return a pointer to that space as <*reason_p>.
|
||||
-----------------------------------------------------------------------------*/
|
||||
int fd;
|
||||
int nread;
|
||||
char myversion[32];
|
||||
char version[32];
|
||||
char full_path[MAXPGPATH];
|
||||
|
||||
PathSetVersionFilePath(path, full_path);
|
||||
|
||||
sprintf(myversion, "%s.%s\n", PG_RELEASE, PG_VERSION);
|
||||
|
||||
if ((fd = open(full_path, O_RDONLY | PG_BINARY, 0)) == -1)
|
||||
{
|
||||
*reason_p = malloc(100 + strlen(full_path));
|
||||
sprintf(*reason_p, "File '%s' does not exist or no read permission.", full_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
nread = read(fd, version, sizeof(version) - 1);
|
||||
if (nread < 4 ||
|
||||
!isdigit((int)version[0]) ||
|
||||
version[nread - 1] != '\n')
|
||||
{
|
||||
*reason_p = malloc(100 + strlen(full_path));
|
||||
sprintf(*reason_p, "File '%s' does not have a valid format "
|
||||
"for a PG_VERSION file.", full_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
version[nread] = '\0';
|
||||
if (strcmp(version, myversion) != 0)
|
||||
{
|
||||
*reason_p = malloc(200 + strlen(full_path));
|
||||
sprintf(*reason_p,
|
||||
"Version number in file '%s' should be %s, "
|
||||
"not %s.",
|
||||
full_path, myversion, version);
|
||||
}
|
||||
else
|
||||
*reason_p = NULL;
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
SetPgVersion(const char *path, char **reason_p)
|
||||
{
|
||||
/*---------------------------------------------------------------------------
|
||||
Create the PG_VERSION file in the directory <path>.
|
||||
|
||||
If we fail, allocate storage, fill it with a text string explaining why,
|
||||
and return a pointer to that storage as <*reason_p>. If we succeed,
|
||||
return *reason_p = NULL.
|
||||
---------------------------------------------------------------------------*/
|
||||
int fd;
|
||||
char version[32];
|
||||
char full_path[MAXPGPATH];
|
||||
|
||||
PathSetVersionFilePath(path, full_path);
|
||||
|
||||
sprintf(version, "%s.%s\n", PG_RELEASE, PG_VERSION);
|
||||
|
||||
fd = open(full_path, O_WRONLY | O_CREAT | O_EXCL | PG_BINARY, 0666);
|
||||
if (fd < 0)
|
||||
{
|
||||
*reason_p = malloc(100 + strlen(full_path));
|
||||
sprintf(*reason_p,
|
||||
"Unable to create file '%s', errno from open(): %s (%d).",
|
||||
full_path, strerror(errno), errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
int rc; /* return code from some function we call */
|
||||
|
||||
rc = write(fd, version, strlen(version));
|
||||
if (rc != strlen(version))
|
||||
{
|
||||
*reason_p = malloc(100 + strlen(full_path));
|
||||
sprintf(*reason_p,
|
||||
"Failed to write to file '%s', after it was already "
|
||||
"open. Errno from write(): %s (%d)",
|
||||
full_path, strerror(errno), errno);
|
||||
}
|
||||
else
|
||||
*reason_p = NULL;
|
||||
close(fd);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue