Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
ac06a7a2
Commit
ac06a7a2
authored
23 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Try to make genbki.sh a little more bulletproof, per trouble report
from Paul Stavrides.
parent
c31bcbc8
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/catalog/genbki.sh
+24
-7
24 additions, 7 deletions
src/backend/catalog/genbki.sh
with
24 additions
and
7 deletions
src/backend/catalog/genbki.sh
+
24
−
7
View file @
ac06a7a2
...
@@ -10,12 +10,12 @@
...
@@ -10,12 +10,12 @@
#
#
#
#
# IDENTIFICATION
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.2
4
2001/
09/08 15
:2
4
:0
0 petere
Exp $
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh,v 1.2
5
2001/
11/30 20
:2
1
:0
6 tgl
Exp $
#
#
# NOTES
# NOTES
# non-essential whitespace is removed from the generated file.
# non-essential whitespace is removed from the generated file.
# if this is ever a problem, then the sed script at the very
# if this is ever a problem, then the sed script at the very
# end can be changed into another awk script or something smarter.
.
# end can be changed into another awk script or something smarter.
#
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
...
@@ -121,7 +121,7 @@ trap "rm -f $TMPFILE ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.description.$$" 0
...
@@ -121,7 +121,7 @@ trap "rm -f $TMPFILE ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.description.$$" 0
# Get NAMEDATALEN from postgres_ext.h
# Get NAMEDATALEN from postgres_ext.h
for
dir
in
$INCLUDE_DIRS
;
do
for
dir
in
$INCLUDE_DIRS
;
do
if
[
-f
"
$dir
/postgres_ext.h"
]
;
then
if
[
-f
"
$dir
/postgres_ext.h"
]
;
then
NAMEDATALEN
=
`
grep
'#define[ ]*NAMEDATALEN'
$dir
/postgres_ext.h |
$AWK
'{ print $3 }'
`
NAMEDATALEN
=
`
grep
'
^
#define[ ]*NAMEDATALEN'
$dir
/postgres_ext.h |
$AWK
'{ print $3 }'
`
break
break
fi
fi
done
done
...
@@ -130,8 +130,8 @@ done
...
@@ -130,8 +130,8 @@ done
# (who needs consistency?)
# (who needs consistency?)
for
dir
in
$INCLUDE_DIRS
;
do
for
dir
in
$INCLUDE_DIRS
;
do
if
[
-f
"
$dir
/pg_config.h"
]
;
then
if
[
-f
"
$dir
/pg_config.h"
]
;
then
INDEXMAXKEYS
=
`
grep
'#define[ ]*INDEX_MAX_KEYS'
$dir
/pg_config.h |
$AWK
'{ print $3 }'
`
INDEXMAXKEYS
=
`
grep
'
^
#define[ ]*INDEX_MAX_KEYS'
$dir
/pg_config.h |
$AWK
'{ print $3 }'
`
DEFAULTATTSTATTARGET
=
`
grep
'#define[ ]*DEFAULT_ATTSTATTARGET'
$dir
/pg_config.h |
$AWK
'{ print $3 }'
`
DEFAULTATTSTATTARGET
=
`
grep
'
^
#define[ ]*DEFAULT_ATTSTATTARGET'
$dir
/pg_config.h |
$AWK
'{ print $3 }'
`
break
break
fi
fi
done
done
...
@@ -139,7 +139,7 @@ done
...
@@ -139,7 +139,7 @@ done
# Get FirstGenBKIObjectId from access/transam.h
# Get FirstGenBKIObjectId from access/transam.h
for
dir
in
$INCLUDE_DIRS
;
do
for
dir
in
$INCLUDE_DIRS
;
do
if
[
-f
"
$dir
/access/transam.h"
]
;
then
if
[
-f
"
$dir
/access/transam.h"
]
;
then
BKIOBJECTID
=
`
grep
'#define[ ]*FirstGenBKIObjectId'
$dir
/access/transam.h |
$AWK
'{ print $3 }'
`
BKIOBJECTID
=
`
grep
'
^
#define[ ]*FirstGenBKIObjectId'
$dir
/access/transam.h |
$AWK
'{ print $3 }'
`
break
break
fi
fi
done
done
...
@@ -372,7 +372,7 @@ inside == 1 {
...
@@ -372,7 +372,7 @@ inside == 1 {
# ----
# ----
# if we are inside the catalog definition, then keep sucking up
# if we are inside the catalog definition, then keep sucking up
# attibute names and types
# att
r
ibute names and types
# ----
# ----
if ($2 ~ /\[.*\]/) { # array attribute
if ($2 ~ /\[.*\]/) { # array attribute
idlen = index($2,"[") - 1;
idlen = index($2,"[") - 1;
...
@@ -401,6 +401,23 @@ $CPP $BKIOPTS $TMPFILE | \
...
@@ -401,6 +401,23 @@ $CPP $BKIOPTS $TMPFILE | \
sed
-e
'/^[ ]*$/d'
\
sed
-e
'/^[ ]*$/d'
\
-e
's/[ ][ ]*/ /g'
>>
${
OUTPUT_PREFIX
}
.bki.
$$
||
exit
-e
's/[ ][ ]*/ /g'
>>
${
OUTPUT_PREFIX
}
.bki.
$$
||
exit
#
# Sanity check: if one of the sed/awk/etc commands fails, we'll probably
# end up with a .bki file that is empty or just a few lines. Cross-check
# that the files are of reasonable size. The numbers here are arbitrary,
# but are much smaller than the actual expected sizes as of Postgres 7.2.
#
if
[
`
wc
-c
<
${
OUTPUT_PREFIX
}
.bki.
$$
`
-lt
100000
]
;
then
echo
"
$CMDNAME
: something seems to be wrong with the .bki file"
>
&2
exit
1
fi
if
[
`
wc
-c
<
${
OUTPUT_PREFIX
}
.description.
$$
`
-lt
10000
]
;
then
echo
"
$CMDNAME
: something seems to be wrong with the .description file"
>
&2
exit
1
fi
# Looks good, commit ...
mv
${
OUTPUT_PREFIX
}
.bki.
$$
${
OUTPUT_PREFIX
}
.bki
||
exit
mv
${
OUTPUT_PREFIX
}
.bki.
$$
${
OUTPUT_PREFIX
}
.bki
||
exit
mv
${
OUTPUT_PREFIX
}
.description.
$$
${
OUTPUT_PREFIX
}
.description
||
exit
mv
${
OUTPUT_PREFIX
}
.description.
$$
${
OUTPUT_PREFIX
}
.description
||
exit
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment