nmtest-relation_openrv.shar
application/x-shar
Filename: nmtest-relation_openrv.shar
Type: application/x-shar
Part: 1
Message:
Make relation_openrv atomic wrt DDL
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.6.3).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `#!/bin/sh' line above, then type `sh FILE'.
#
lock_dir=_sh19965
# Made on 2011-06-12 03:15 EDT by <nm@tornado>.
# Source directory was `/home/nm/src/pg'.
#
# Existing files will *not* be overwritten, unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 78 -rw------- nmtest/nmtest--1.0.sql
# 539 -rw------- nmtest/nmtest.c
# 135 -rw------- nmtest/Makefile
# 78 -rw------- nmtest/nmtest.control
#
MD5SUM=${MD5SUM-md5sum}
f=`${MD5SUM} --version | egrep '^md5sum .*(core|text)utils'`
test -n "${f}" && md5check=true || md5check=false
${md5check} || \
echo 'Note: not verifying md5sums. Consider installing GNU coreutils.'
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
case `$dir/gettext --version 2>&1 | sed 1q` in
*GNU*) gettext_dir=$dir ;;
esac
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null
then if (echo -n test; echo 1,2,3) | grep n >/dev/null
then shar_n= shar_c='
'
else shar_n=-n shar_c= ; fi
else shar_n= shar_c='\c' ; fi
f=shar-touch.$$
st1=200112312359.59
st2=123123592001.59
st2tr=123123592001.5 # old SysV 14-char limit
st3=1231235901
if touch -am -t ${st1} ${f} >/dev/null 2>&1 && \
test ! -f ${st1} && test -f ${f}; then
shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am ${st2} ${f} >/dev/null 2>&1 && \
test ! -f ${st2} && test ! -f ${st2tr} && test -f ${f}; then
shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am ${st3} ${f} >/dev/null 2>&1 && \
test ! -f ${st3} && test -f ${f}; then
shar_touch='touch -am $3$4$5$6$2 "$8"'
else
shar_touch=:
echo
${echo} 'WARNING: not restoring timestamps. Consider getting and'
${echo} 'installing GNU `touch'\'', distributed in GNU coreutils...'
echo
fi
rm -f ${st1} ${st2} ${st2tr} ${st3} ${f}
#
if test ! -d ${lock_dir}
then : ; else ${echo} 'lock directory '${lock_dir}' exists'
exit 1
fi
if mkdir ${lock_dir}
then ${echo} 'x - created lock directory `'${lock_dir}\''.'
else ${echo} 'x - failed to create lock directory `'${lock_dir}\''.'
exit 1
fi
# ============= nmtest/nmtest--1.0.sql ==============
if test ! -d 'nmtest'; then
mkdir 'nmtest'
if test $? -eq 0
then ${echo} 'x - created directory `nmtest'\''.'
else ${echo} 'x - failed to create directory `nmtest'\''.'
exit 1
fi
fi
if test -f 'nmtest/nmtest--1.0.sql' && test "$first_param" != -c; then
${echo} 'x -SKIPPING nmtest/nmtest--1.0.sql (file already exists)'
else
${echo} 'x - extracting nmtest/nmtest--1.0.sql (text)'
sed 's/^X//' << 'SHAR_EOF' > 'nmtest/nmtest--1.0.sql' &&
CREATE FUNCTION nmtest(int)
X RETURNS int
X AS 'MODULE_PATHNAME'
X LANGUAGE 'C';
SHAR_EOF
(set 20 11 06 12 00 13 59 'nmtest/nmtest--1.0.sql'; eval "$shar_touch") &&
chmod 0600 'nmtest/nmtest--1.0.sql'
if test $? -ne 0
then ${echo} 'restore of nmtest/nmtest--1.0.sql failed'
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'nmtest/nmtest--1.0.sql: MD5 check failed'
) << SHAR_EOF
e74ebc7104beabb384bf3875272a4a04 nmtest/nmtest--1.0.sql
SHAR_EOF
else
test `LC_ALL=C wc -c < 'nmtest/nmtest--1.0.sql'` -ne 78 && \
${echo} 'restoration warning: size of nmtest/nmtest--1.0.sql is not 78'
fi
fi
# ============= nmtest/nmtest.c ==============
if test ! -d 'nmtest'; then
mkdir 'nmtest'
if test $? -eq 0
then ${echo} 'x - created directory `nmtest'\''.'
else ${echo} 'x - failed to create directory `nmtest'\''.'
exit 1
fi
fi
if test -f 'nmtest/nmtest.c' && test "$first_param" != -c; then
${echo} 'x -SKIPPING nmtest/nmtest.c (file already exists)'
else
${echo} 'x - extracting nmtest/nmtest.c (text)'
sed 's/^X//' << 'SHAR_EOF' > 'nmtest/nmtest.c' &&
#include "postgres.h"
X
#include "access/heapam.h"
#include "fmgr.h"
#include "nodes/makefuncs.h"
#include "nodes/primnodes.h"
#include "storage/lock.h"
#include "utils/relcache.h"
X
PG_MODULE_MAGIC;
X
extern Datum nmtest(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(nmtest);
X
Datum
nmtest(PG_FUNCTION_ARGS)
{
X int32 n = PG_GETARG_INT32(0);
X int i;
X RangeVar *rv = makeRangeVar(NULL, "pg_am", 0);
X
X for (i = 0; i < n; ++i)
X {
X Relation r = relation_openrv(rv, AccessShareLock);
X relation_close(r, AccessShareLock);
X }
X PG_RETURN_INT32(4);
}
SHAR_EOF
(set 20 11 06 12 03 15 48 'nmtest/nmtest.c'; eval "$shar_touch") &&
chmod 0600 'nmtest/nmtest.c'
if test $? -ne 0
then ${echo} 'restore of nmtest/nmtest.c failed'
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'nmtest/nmtest.c: MD5 check failed'
) << SHAR_EOF
14961960d14e20a02391986664197954 nmtest/nmtest.c
SHAR_EOF
else
test `LC_ALL=C wc -c < 'nmtest/nmtest.c'` -ne 539 && \
${echo} 'restoration warning: size of nmtest/nmtest.c is not 539'
fi
fi
# ============= nmtest/Makefile ==============
if test -f 'nmtest/Makefile' && test "$first_param" != -c; then
${echo} 'x -SKIPPING nmtest/Makefile (file already exists)'
else
${echo} 'x - extracting nmtest/Makefile (text)'
sed 's/^X//' << 'SHAR_EOF' > 'nmtest/Makefile' &&
EXTENSION = nmtest
MODULES = nmtest
DATA = nmtest--1.0.sql
X
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
SHAR_EOF
(set 20 11 06 12 00 11 16 'nmtest/Makefile'; eval "$shar_touch") &&
chmod 0600 'nmtest/Makefile'
if test $? -ne 0
then ${echo} 'restore of nmtest/Makefile failed'
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'nmtest/Makefile: MD5 check failed'
) << SHAR_EOF
97cc4bf914b0f0319baeb793e196b90e nmtest/Makefile
SHAR_EOF
else
test `LC_ALL=C wc -c < 'nmtest/Makefile'` -ne 135 && \
${echo} 'restoration warning: size of nmtest/Makefile is not 135'
fi
fi
# ============= nmtest/nmtest.control ==============
if test -f 'nmtest/nmtest.control' && test "$first_param" != -c; then
${echo} 'x -SKIPPING nmtest/nmtest.control (file already exists)'
else
${echo} 'x - extracting nmtest/nmtest.control (text)'
sed 's/^X//' << 'SHAR_EOF' > 'nmtest/nmtest.control' &&
default_version = '1.0'
module_pathname = '$libdir/nmtest'
relocatable = true
SHAR_EOF
(set 20 11 06 12 00 10 15 'nmtest/nmtest.control'; eval "$shar_touch") &&
chmod 0600 'nmtest/nmtest.control'
if test $? -ne 0
then ${echo} 'restore of nmtest/nmtest.control failed'
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'nmtest/nmtest.control: MD5 check failed'
) << SHAR_EOF
5f70bc1aebbcd49ac9a9fa31297b1bd3 nmtest/nmtest.control
SHAR_EOF
else
test `LC_ALL=C wc -c < 'nmtest/nmtest.control'` -ne 78 && \
${echo} 'restoration warning: size of nmtest/nmtest.control is not 78'
fi
fi
if rm -fr ${lock_dir}
then ${echo} 'x - removed lock directory `'${lock_dir}\''.'
else ${echo} 'x - failed to remove lock directory `'${lock_dir}\''.'
exit 1
fi
exit 0