Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5d2fdf6

Browse files
committed
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 tookcare of in this patch. The other suspicious place was instring_to_dataum (which is defined in both selfuncs.c and indxpath.c). Iwasn't too sure about those, so I left them be.Joe Conway
1 parentbe9728a commit5d2fdf6

File tree

7 files changed

+62
-10
lines changed

7 files changed

+62
-10
lines changed

‎src/backend/utils/adt/varlena.c

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.83 2002/04/15 07:54:37 ishii Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.84 2002/04/24 02:12:53 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -228,6 +228,46 @@ textout(PG_FUNCTION_ARGS)
228228
}
229229

230230

231+
/*
232+
*unknownin- converts "..." to internal representation
233+
*/
234+
Datum
235+
unknownin(PG_FUNCTION_ARGS)
236+
{
237+
char*inputStr=PG_GETARG_CSTRING(0);
238+
unknown*result;
239+
intlen;
240+
241+
len=strlen(inputStr)+VARHDRSZ;
242+
243+
result= (unknown*)palloc(len);
244+
VARATT_SIZEP(result)=len;
245+
246+
memcpy(VARDATA(result),inputStr,len-VARHDRSZ);
247+
248+
PG_RETURN_UNKNOWN_P(result);
249+
}
250+
251+
252+
/*
253+
*unknownout- converts internal representation to "..."
254+
*/
255+
Datum
256+
unknownout(PG_FUNCTION_ARGS)
257+
{
258+
unknown*t=PG_GETARG_UNKNOWN_P(0);
259+
intlen;
260+
char*result;
261+
262+
len=VARSIZE(t)-VARHDRSZ;
263+
result= (char*)palloc(len+1);
264+
memcpy(result,VARDATA(t),len);
265+
result[len]='\0';
266+
267+
PG_RETURN_CSTRING(result);
268+
}
269+
270+
231271
/* ========== PUBLIC ROUTINES ========== */
232272

233273
/*

‎src/include/c.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: c.h,v 1.117 2002/04/23 15:45:30 tgl Exp $
15+
* $Id: c.h,v 1.118 2002/04/24 02:12:53 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -404,6 +404,7 @@ struct varlena
404404
*/
405405
typedefstructvarlenabytea;
406406
typedefstructvarlenatext;
407+
typedefstructvarlenaunknown;
407408
typedefstructvarlenaBpChar;/* blank-padded char, ie SQL char(n) */
408409
typedefstructvarlenaVarChar;/* var-length char, ie SQL varchar(n) */
409410

‎src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $Id: catversion.h,v 1.122 2002/04/21 19:48:22 thomas Exp $
40+
* $Id: catversion.h,v 1.123 2002/04/24 02:12:53 momjian Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO200204211
56+
#defineCATALOG_VERSION_NO200204231
5757

5858
#endif

‎src/include/catalog/pg_proc.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_proc.h,v 1.229 2002/04/21 19:48:23 thomas Exp $
10+
* $Id: pg_proc.h,v 1.230 2002/04/24 02:12:53 momjian Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -237,6 +237,11 @@ DESCR("join selectivity of < and related operators on scalar datatypes");
237237
DATA(insertOID=108 (scalargtjoinselPGNSPPGUID12ftftfs3701"0 26 0"10000100scalargtjoinsel-_null_ ));
238238
DESCR("join selectivity of > and related operators on scalar datatypes");
239239

240+
DATA(insertOID=109 (unknowninPGNSPPGUID12ftti1f705"0"10000100unknownin-_null_ ));
241+
DESCR("(internal)");
242+
DATA(insertOID=110 (unknownoutPGNSPPGUID12ftti1f23"0"10000100unknownout-_null_ ));
243+
DESCR("(internal)");
244+
240245
DATA(insertOID=112 (textPGNSPPGUID12ftttfi125"23"10000100int4_text-_null_ ));
241246
DESCR("convert int4 to text");
242247
DATA(insertOID=113 (textPGNSPPGUID12ftttfi125"21"10000100int2_text-_null_ ));

‎src/include/catalog/pg_type.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $Id: pg_type.h,v 1.120 2002/04/21 00:26:43 tgl Exp $
11+
* $Id: pg_type.h,v 1.121 2002/04/24 02:12:53 momjian Exp $
1212
*
1313
* NOTES
1414
* the genbki.sh script reads this file and generates .bki
@@ -302,7 +302,7 @@ DATA(insert OID = 30 (oidvector PGNSP PGUID INDEX_MAX_KEYS*4 -1 f b t \054 0
302302
DESCR("array of INDEX_MAX_KEYS oids, used in system tables");
303303
#defineOIDVECTOROID30
304304

305-
DATA(insertOID=32 (SETPGNSPPGUID-1-1fbt \05400textintextouttextintextoutipf0-10_null__null_ ));
305+
DATA(insertOID=32 (SETPGNSPPGUID-1-1fbt \05400unknowninunknownoutunknowninunknownoutipf0-10_null__null_ ));
306306
DESCR("set of tuples");
307307

308308
DATA(insertOID=71 (pg_typePGNSPPGUID44tct \05412470int4inint4outint4inint4outipf0-10_null__null_ ));
@@ -366,7 +366,7 @@ DESCR("relative, limited-range time interval (Unix delta time)");
366366
DATA(insertOID=704 (tintervalPGNSPPGUID1247fbt \05400tintervalintintervalouttintervalintintervaloutipf0-10_null__null_ ));
367367
DESCR("(abstime,abstime), time interval");
368368
#defineTINTERVALOID704
369-
DATA(insertOID=705 (unknownPGNSPPGUID-1-1fbt \05400textintextouttextintextoutipf0-10_null__null_ ));
369+
DATA(insertOID=705 (unknownPGNSPPGUID-1-1fbt \05400unknowninunknownoutunknowninunknownoutipf0-10_null__null_ ));
370370
DESCR("");
371371
#defineUNKNOWNOID705
372372

‎src/include/fmgr.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $Id: fmgr.h,v 1.19 2002/03/05 05:33:22 momjian Exp $
14+
* $Id: fmgr.h,v 1.20 2002/04/24 02:12:53 momjian Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -185,6 +185,7 @@ extern struct varlena *pg_detoast_datum_slice(struct varlena * datum,
185185
/* DatumGetFoo macros for varlena types will typically look like this: */
186186
#defineDatumGetByteaP(X)((bytea *) PG_DETOAST_DATUM(X))
187187
#defineDatumGetTextP(X)((text *) PG_DETOAST_DATUM(X))
188+
#defineDatumGetUnknownP(X)((unknown *) PG_DETOAST_DATUM(X))
188189
#defineDatumGetBpCharP(X)((BpChar *) PG_DETOAST_DATUM(X))
189190
#defineDatumGetVarCharP(X)((VarChar *) PG_DETOAST_DATUM(X))
190191
/* And we also offer variants that return an OK-to-write copy */
@@ -200,6 +201,7 @@ extern struct varlena *pg_detoast_datum_slice(struct varlena * datum,
200201
/* GETARG macros for varlena types will typically look like this: */
201202
#definePG_GETARG_BYTEA_P(n)DatumGetByteaP(PG_GETARG_DATUM(n))
202203
#definePG_GETARG_TEXT_P(n)DatumGetTextP(PG_GETARG_DATUM(n))
204+
#definePG_GETARG_UNKNOWN_P(n)DatumGetUnknownP(PG_GETARG_DATUM(n))
203205
#definePG_GETARG_BPCHAR_P(n)DatumGetBpCharP(PG_GETARG_DATUM(n))
204206
#definePG_GETARG_VARCHAR_P(n)DatumGetVarCharP(PG_GETARG_DATUM(n))
205207
/* And we also offer variants that return an OK-to-write copy */
@@ -239,6 +241,7 @@ extern struct varlena *pg_detoast_datum_slice(struct varlena * datum,
239241
/* RETURN macros for other pass-by-ref types will typically look like this: */
240242
#definePG_RETURN_BYTEA_P(x) PG_RETURN_POINTER(x)
241243
#definePG_RETURN_TEXT_P(x) PG_RETURN_POINTER(x)
244+
#definePG_RETURN_UNKNOWN_P(x) PG_RETURN_POINTER(x)
242245
#definePG_RETURN_BPCHAR_P(x) PG_RETURN_POINTER(x)
243246
#definePG_RETURN_VARCHAR_P(x) PG_RETURN_POINTER(x)
244247

‎src/include/utils/builtins.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: builtins.h,v 1.177 2002/04/18 20:01:11 tgl Exp $
10+
* $Id: builtins.h,v 1.178 2002/04/24 02:12:53 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -414,6 +414,9 @@ extern List *textToQualifiedNameList(text *textval, const char *caller);
414414
externboolSplitIdentifierString(char*rawstring,charseparator,
415415
List**namelist);
416416

417+
externDatumunknownin(PG_FUNCTION_ARGS);
418+
externDatumunknownout(PG_FUNCTION_ARGS);
419+
417420
externDatumbyteain(PG_FUNCTION_ARGS);
418421
externDatumbyteaout(PG_FUNCTION_ARGS);
419422
externDatumbyteaoctetlen(PG_FUNCTION_ARGS);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp