diff options
author | Bruce Momjian <bruce@momjian.us> | 1998-01-16 23:21:07 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1998-01-16 23:21:07 +0000 |
commit | c65ea0e040f08b59407cd74f8f0f0dd190169d46 (patch) | |
tree | 5d46c03cb5ddd61ed5e0693b261965cb2fae8b95 /src/backend/utils/adt | |
parent | d7427e4802fd4d7108e37544115cab83c13172ab (diff) | |
download | postgresql-c65ea0e040f08b59407cd74f8f0f0dd190169d46.tar.gz postgresql-c65ea0e040f08b59407cd74f8f0f0dd190169d46.zip |
New pg_attribute.atttypmod for type-specific information like
varchar length.
Cleans up code so attlen is always length.
Removed varchar() hack added earlier.
Will fix bug in selecting varchar() fields, and varchar() can be
variable length.
Diffstat (limited to 'src/backend/utils/adt')
-rw-r--r-- | src/backend/utils/adt/varchar.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c index 2aaf0a58b8b..cb17194e252 100644 --- a/src/backend/utils/adt/varchar.c +++ b/src/backend/utils/adt/varchar.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.23 1998/01/08 06:18:18 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.24 1998/01/16 23:20:34 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -50,7 +50,7 @@ * because we pass typelem as the second argument for array_in.) */ char * -bpcharin(char *s, int dummy, int typlen) +bpcharin(char *s, int dummy, int atttypmod) { char *result, *r; @@ -60,23 +60,23 @@ bpcharin(char *s, int dummy, int typlen) if (s == NULL) return ((char *) NULL); - if (typlen == -1) + if (atttypmod == -1) { /* - * this is here because some functions can't supply the typlen + * this is here because some functions can't supply the atttypmod */ len = strlen(s); - typlen = len + VARHDRSZ; + atttypmod = len + VARHDRSZ; } else - len = typlen - VARHDRSZ; + len = atttypmod - VARHDRSZ; if (len > 4096) elog(ERROR, "bpcharin: length of char() must be less than 4096"); - result = (char *) palloc(typlen); - VARSIZE(result) = typlen; + result = (char *) palloc(atttypmod); + VARSIZE(result) = atttypmod; r = VARDATA(result); for (i = 0; i < len; i++, r++, s++) { @@ -124,7 +124,7 @@ bpcharout(char *s) * because we pass typelem as the second argument for array_in.) */ char * -varcharin(char *s, int dummy, int typlen) +varcharin(char *s, int dummy, int atttypmod) { char *result; int len; @@ -133,8 +133,8 @@ varcharin(char *s, int dummy, int typlen) return ((char *) NULL); len = strlen(s) + VARHDRSZ; - if (typlen != -1 && len > typlen) - len = typlen; /* clip the string at max length */ + if (atttypmod != -1 && len > atttypmod) + len = atttypmod; /* clip the string at max length */ if (len > 4096) elog(ERROR, "varcharin: length of char() must be less than 4096"); |