diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-04-04 19:35:37 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-04-04 19:35:37 +0000 |
| commit | 147d4bf3e5e3da2ee0f0cc132718ab1c4912a877 (patch) | |
| tree | e02e6a191197edb5224ab5f831146854fde7d460 /src/include/fmgr.h | |
| parent | eaef111396ef7e70c88979c7a82f6a8f918d9651 (diff) | |
| download | postgresql-147d4bf3e5e3da2ee0f0cc132718ab1c4912a877.tar.gz | |
Modify all callers of datatype input and receive functions so that if these
functions are not strict, they will be called (passing a NULL first parameter)
during any attempt to input a NULL value of their datatype. Currently, all
our input functions are strict and so this commit does not change any
behavior. However, this will make it possible to build domain input functions
that centralize checking of domain constraints, thereby closing numerous holes
in our domain support, as per previous discussion.
While at it, I took the opportunity to introduce convenience functions
InputFunctionCall, OutputFunctionCall, etc to use in code that calls I/O
functions. This eliminates a lot of grotty-looking casts, but the main
motivation is to make it easier to grep for these places if we ever need
to touch them again.
Diffstat (limited to 'src/include/fmgr.h')
| -rw-r--r-- | src/include/fmgr.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/include/fmgr.h b/src/include/fmgr.h index 9f17a24357..0d6e72594d 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/fmgr.h,v 1.42 2006/03/05 15:58:52 momjian Exp $ + * $PostgreSQL: pgsql/src/include/fmgr.h,v 1.43 2006/04/04 19:35:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,6 +20,8 @@ /* We don't want to include primnodes.h here, so make a stub reference */ typedef struct Node *fmNodePtr; +/* Likewise, avoid including stringinfo.h here */ +typedef struct StringInfoData *fmStringInfo; /* @@ -394,6 +396,20 @@ extern Datum OidFunctionCall9(Oid functionId, Datum arg1, Datum arg2, Datum arg6, Datum arg7, Datum arg8, Datum arg9); +/* Special cases for convenient invocation of datatype I/O functions. */ +extern Datum InputFunctionCall(FmgrInfo *flinfo, char *str, + Oid typioparam, int32 typmod); +extern Datum OidInputFunctionCall(Oid functionId, char *str, + Oid typioparam, int32 typmod); +extern char *OutputFunctionCall(FmgrInfo *flinfo, Datum val); +extern char *OidOutputFunctionCall(Oid functionId, Datum val); +extern Datum ReceiveFunctionCall(FmgrInfo *flinfo, fmStringInfo buf, + Oid typioparam, int32 typmod); +extern Datum OidReceiveFunctionCall(Oid functionId, fmStringInfo buf, + Oid typioparam, int32 typmod); +extern bytea *SendFunctionCall(FmgrInfo *flinfo, Datum val); +extern bytea *OidSendFunctionCall(Oid functionId, Datum val); + /* * Routines in fmgr.c |
