Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 66371
Collapse All | Expand All

(-)postgresql-7.4.5.orig/contrib/findoidjoins/make_oidjoins_check (-9 / +17 lines)
Lines 10-36 Link Here
10
# Caution: you may need to use GNU awk.
10
# Caution: you may need to use GNU awk.
11
AWK=${AWK:-awk}
11
AWK=${AWK:-awk}
12
12
13
trap "rm -f /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
13
TMP=
14
TMPA=
15
TMPB=
16
trap 'rm -f -- "$TMP" "$TMPA" "$TMPB"' EXIT
17
trap 'trap - EXIT; rm -f -- "$TMP" "$TMPA" "$TMPB"; exit 1' HUP INT QUIT TERM
18
19
TMP=`mktemp -t oidjoins.XXXXXX` || exit 1
20
TMPA=`mktemp -t oidjoins.a.XXXXXX` || exit 1
21
TMPB=`mktemp -t oidjoins.b.XXXXXX` || exit 1
14
22
15
# Read input
23
# Read input
16
cat "$@" >/tmp/$$
24
cat "$@" > $TMP
17
25
18
# Look for fields with multiple references.
26
# Look for fields with multiple references.
19
cat /tmp/$$ | cut -d' ' -f2 | sort | uniq -d >/tmp/$$a
27
cat $TMP | cut -d' ' -f2 | sort | uniq -d > $TMPA
20
if [ -s /tmp/$$a ] ; then
28
if [ -s $TMPA ] ; then
21
	echo "Ignoring these fields that link to multiple tables:" 1>&2
29
	echo "Ignoring these fields that link to multiple tables:" 1>&2
22
	cat /tmp/$$a 1>&2
30
	cat $TMPA 1>&2
23
fi
31
fi
24
32
25
# Get the non-multiply-referenced fields.
33
# Get the non-multiply-referenced fields.
26
cat /tmp/$$ | while read LINE
34
cat $TMP | while read LINE
27
do
35
do
28
	set -- $LINE
36
	set -- $LINE
29
	grep "^$2\$" /tmp/$$a >/dev/null 2>&1 || echo $LINE
37
	grep "^$2\$" $TMPA >/dev/null 2>&1 || echo $LINE
30
done >/tmp/$$b
38
done > $TMPB
31
39
32
# Generate the output.
40
# Generate the output.
33
cat /tmp/$$b |
41
cat $TMPB |
34
$AWK -F'[ \.]' '\
42
$AWK -F'[ \.]' '\
35
	BEGIN \
43
	BEGIN \
36
	{
44
	{

Return to bug 66371