1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Here's a patch to add unknownin/unknownout support. I also poked around

looking for places that assume UNKNOWN == TEXT. One of those was the
"SET" type in pg_type.h, which was using textin/textout. This one I took
care of in this patch. The other suspicious place was in
string_to_dataum (which is defined in both selfuncs.c and indxpath.c). I
wasn't too sure about those, so I left them be.

Joe Conway
This commit is contained in:
Bruce Momjian
2002-04-24 02:12:53 +00:00
parent be9728acf1
commit 5d2fdf6e6d
7 changed files with 62 additions and 10 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.83 2002/04/15 07:54:37 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.84 2002/04/24 02:12:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -228,6 +228,46 @@ textout(PG_FUNCTION_ARGS)
}
/*
* unknownin - converts "..." to internal representation
*/
Datum
unknownin(PG_FUNCTION_ARGS)
{
char *inputStr = PG_GETARG_CSTRING(0);
unknown *result;
int len;
len = strlen(inputStr) + VARHDRSZ;
result = (unknown *) palloc(len);
VARATT_SIZEP(result) = len;
memcpy(VARDATA(result), inputStr, len - VARHDRSZ);
PG_RETURN_UNKNOWN_P(result);
}
/*
* unknownout - converts internal representation to "..."
*/
Datum
unknownout(PG_FUNCTION_ARGS)
{
unknown *t = PG_GETARG_UNKNOWN_P(0);
int len;
char *result;
len = VARSIZE(t) - VARHDRSZ;
result = (char *) palloc(len + 1);
memcpy(result, VARDATA(t), len);
result[len] = '\0';
PG_RETURN_CSTRING(result);
}
/* ========== PUBLIC ROUTINES ========== */
/*