diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-10 21:14:00 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-10 21:14:00 +0000 |
commit | d78397d301172cccce14d5d789f296c47dd47c5e (patch) | |
tree | 4104dc887976aee14286c0c0a7be03f84af43b7d /src/backend/commands/typecmds.c | |
parent | 2e330699fae72c40f5237ce0f4fc210c483d2816 (diff) | |
download | postgresql-d78397d301172cccce14d5d789f296c47dd47c5e.tar.gz postgresql-d78397d301172cccce14d5d789f296c47dd47c5e.zip |
Change typreceive function API so that receive functions get the same
optional arguments as text input functions, ie, typioparam OID and
atttypmod. Make all the datatypes that use typmod enforce it the same
way in typreceive as they do in typinput. This fixes a problem with
failure to enforce length restrictions during COPY FROM BINARY.
Diffstat (limited to 'src/backend/commands/typecmds.c')
-rw-r--r-- | src/backend/commands/typecmds.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index e5f2a2f762b..7406e15376a 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.74 2005/07/07 20:39:58 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.75 2005/07/10 21:13:58 tgl Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -859,7 +859,7 @@ findTypeInputFunction(List *procname, Oid typeOid) /* * Input functions can take a single argument of type CSTRING, or - * three arguments (string, element OID, typmod). + * three arguments (string, typioparam OID, typmod). * * For backwards compatibility we allow OPAQUE in place of CSTRING; if we * see this, we issue a warning and fix up the pg_proc entry. @@ -973,12 +973,12 @@ findTypeOutputFunction(List *procname, Oid typeOid) static Oid findTypeReceiveFunction(List *procname, Oid typeOid) { - Oid argList[2]; + Oid argList[3]; Oid procOid; /* * Receive functions can take a single argument of type INTERNAL, or - * two arguments (internal, oid). + * three arguments (internal, typioparam OID, typmod). */ argList[0] = INTERNALOID; @@ -987,8 +987,9 @@ findTypeReceiveFunction(List *procname, Oid typeOid) return procOid; argList[1] = OIDOID; + argList[2] = INT4OID; - procOid = LookupFuncName(procname, 2, argList, true); + procOid = LookupFuncName(procname, 3, argList, true); if (OidIsValid(procOid)) return procOid; |