diff options
| author | Bruce Momjian <bruce@momjian.us> | 2006-02-12 03:22:21 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2006-02-12 03:22:21 +0000 |
| commit | f9a726aa883e1690f66bec535d85b34e1f9ed7e7 (patch) | |
| tree | 764d3d849a2614ea5edcd05eaa36496a79f06c87 /src/backend/catalog/genbki.sh | |
| parent | 95dbf9c02f9a37fc171e0b94b37f9f903abc3942 (diff) | |
| download | postgresql-f9a726aa883e1690f66bec535d85b34e1f9ed7e7.tar.gz | |
I've created a new shared catalog table pg_shdescription to store
comments on cluster global objects like databases, tablespaces, and
roles.
It touches a lot of places, but not much in the way of big changes. The
only design decision I made was to duplicate the query and manipulation
functions rather than to try and have them handle both shared and local
comments. I believe this is simpler for the code and not an issue for
callers because they know what type of object they are dealing with.
This has resulted in a shobj_description function analagous to
obj_description and backend functions [Create/Delete]SharedComments
mirroring the existing [Create/Delete]Comments functions.
pg_shdescription.h goes into src/include/catalog/
Kris Jurka
Diffstat (limited to 'src/backend/catalog/genbki.sh')
| -rw-r--r-- | src/backend/catalog/genbki.sh | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/backend/catalog/genbki.sh b/src/backend/catalog/genbki.sh index 9d9b75bde5..4f6b6b2ec6 100644 --- a/src/backend/catalog/genbki.sh +++ b/src/backend/catalog/genbki.sh @@ -11,7 +11,7 @@ # # # IDENTIFICATION -# $PostgreSQL: pgsql/src/backend/catalog/genbki.sh,v 1.37 2005/06/28 05:08:52 tgl Exp $ +# $PostgreSQL: pgsql/src/backend/catalog/genbki.sh,v 1.38 2006/02/12 03:22:17 momjian Exp $ # # NOTES # non-essential whitespace is removed from the generated file. @@ -103,7 +103,7 @@ fi TMPFILE="genbkitmp$$.c" -trap "rm -f $TMPFILE ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.description.$$" 0 1 2 3 15 +trap "rm -f $TMPFILE ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.description.$$ ${OUTPUT_PREFIX}.shdescription.$$" 0 1 2 3 15 # Get NAMEDATALEN from postgres_ext.h @@ -131,6 +131,7 @@ for dir in $INCLUDE_DIRS; do done touch ${OUTPUT_PREFIX}.description.$$ +touch ${OUTPUT_PREFIX}.shdescription.$$ # ---------------- # Strip comments and other trash from .h @@ -201,7 +202,7 @@ comment_level > 0 { next; } # ---------------- # DATA() statements are basically passed right through after # stripping off the DATA( and the ) on the end. -# Remember the OID for use by DESCR(). +# Remember the OID for use by DESCR() and SHDESCR(). # ---------------- /^DATA\(/ { data = substr($0, 6, length($0) - 6); @@ -225,6 +226,16 @@ comment_level > 0 { next; } next; } +/^SHDESCR\(/ { + if (oid != 0) + { + data = substr($0, 10, length($0) - 11); + if (data != "") + printf "%d\t%s\t%s\n", oid, catalog, data >>shdescriptionfile; + } + next; +} + /^DECLARE_INDEX\(/ { # ---- # end any prior catalog data insertions before starting a define index @@ -365,7 +376,7 @@ END { reln_open = 0; } } -' "descriptionfile=${OUTPUT_PREFIX}.description.$$" > $TMPFILE || exit +' "descriptionfile=${OUTPUT_PREFIX}.description.$$" "shdescriptionfile=${OUTPUT_PREFIX}.shdescription.$$" > $TMPFILE || exit echo "# PostgreSQL $major_version" >${OUTPUT_PREFIX}.bki.$$ @@ -386,10 +397,15 @@ if [ `wc -c < ${OUTPUT_PREFIX}.description.$$` -lt 10000 ]; then echo "$CMDNAME: something seems to be wrong with the .description file" >&2 exit 1 fi +if [ `wc -c < ${OUTPUT_PREFIX}.shdescription.$$` -lt 10 ]; then + echo "$CMDNAME: something seems to be wrong with the .shdescription file" >&2 + exit 1 +fi # Looks good, commit ... mv ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.bki || exit mv ${OUTPUT_PREFIX}.description.$$ ${OUTPUT_PREFIX}.description || exit +mv ${OUTPUT_PREFIX}.shdescription.$$ ${OUTPUT_PREFIX}.shdescription || exit exit 0 |
