Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit85e91d7

Browse files
committed
Added catalog version checking to pgpro_upgrade. Now correct catversion and major version is hardcoded
1 parentcfb0d4c commit85e91d7

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATEFUNCTIONpg_catalog.pgpro_build() RETURNSTEXTAS'pgpro_build' LANGUAGE internal STRICT IMMUTABLE;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SELECT COUNT(*) > 0 AS pgpro_build FROM pg_proc WHERE proname = 'pgpro_build' AND pronamespace = 11;

‎src/pgpro-upgrade/pgpro_upgrade‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,37 @@ case "$PGBIN" in
2727
;;
2828
esac
2929

30+
# Check the catalog version
31+
CATALOG_VERSION_NO=2016081311
32+
MAJORVER=$9.6
33+
CATVER=`${PGBIN}pg_controldata|sed -n'/Catalog version number:/s/^.*: *//p'`
34+
if ["$CATVER"!=$CATALOG_VERSION_NO ];then
35+
if [!-f"${PGDATA}/global/pg_control" ];then
36+
# looks like we have Debian with separate directory for configs
37+
SAVE_PGDATA="$PGDATA"
38+
PGDATA=`sed -n"/data_directory/{s/^data_directory = '//
39+
s/'.*$//
40+
p}" /etc/postgresql/9.6/main/postgresql.conf`
41+
if [-z"$PGDATA"-o!-f"${PGDATA}/global/pg_control" ];then
42+
echo"Cannot find valid database in$PGDATA"2>&1;
43+
exit 1
44+
fi
45+
fi
46+
# Fix pg_control file
47+
"${PGBIN}pg_controldata" -c
48+
# Fix tablespace directories
49+
(cd"$PGDATA/pg_tblspc"
50+
foriin*;do
51+
["$i"="*" ]&&break# Glob pattern not expanded
52+
(cd$i; mv PG_${MAJORVER}_$CATVER PG_${MAJORVER}_$CATALOG_VERSION_NO)
53+
done
54+
)
55+
if [-n"$SAVE_PGDATA" ]then
56+
PGDATA="$SAVE_PGDATA"
57+
fi
58+
fi
59+
60+
3061
fordirin"$PGSHARE" /usr/pgsql-9.6/share /usr/share/postgresql/9.6 /usr/pgsql/9.6/share /usr/share/pgsql /usr/share/postgrespro96;do
3162
if [-d"$dir/pgpro-upgrade" ];then
3263
DIR="$dir/pgpro-upgrade"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp