mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Un-break CREATE TYPE. Fix some other inconsistencies in the
pg_proc entries for array I/O routines besides the one detected by the original patcher. Tighten type_sanity regress test accordingly.
This commit is contained in:
parent
09c5e84072
commit
00fbb64bed
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.35 1999/02/13 23:14:59 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.36 1999/04/20 03:51:14 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -390,11 +390,6 @@ TypeCreate(char *typeName,
|
|||||||
values[i++] = (Datum) (typeType == 'c' ? relationOid : InvalidOid); /* 9 */
|
values[i++] = (Datum) (typeType == 'c' ? relationOid : InvalidOid); /* 9 */
|
||||||
values[i++] = (Datum) elementObjectId; /* 10 */
|
values[i++] = (Datum) elementObjectId; /* 10 */
|
||||||
|
|
||||||
/*
|
|
||||||
* arguments to type input and output functions must be 0
|
|
||||||
*/
|
|
||||||
MemSet(argList, 0, 8 * sizeof(Oid));
|
|
||||||
|
|
||||||
procs[0] = inputProcedure;
|
procs[0] = inputProcedure;
|
||||||
procs[1] = outputProcedure;
|
procs[1] = outputProcedure;
|
||||||
procs[2] = (receiveProcedure) ? receiveProcedure : inputProcedure;
|
procs[2] = (receiveProcedure) ? receiveProcedure : inputProcedure;
|
||||||
@ -404,6 +399,12 @@ TypeCreate(char *typeName,
|
|||||||
{
|
{
|
||||||
procname = procs[j];
|
procname = procs[j];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* First look for a 1-argument func with all argtypes 0.
|
||||||
|
* This is valid for all four kinds of procedure.
|
||||||
|
*/
|
||||||
|
MemSet(argList, 0, 8 * sizeof(Oid));
|
||||||
|
|
||||||
tup = SearchSysCacheTuple(PRONAME,
|
tup = SearchSysCacheTuple(PRONAME,
|
||||||
PointerGetDatum(procname),
|
PointerGetDatum(procname),
|
||||||
Int32GetDatum(1),
|
Int32GetDatum(1),
|
||||||
@ -412,17 +413,28 @@ TypeCreate(char *typeName,
|
|||||||
|
|
||||||
if (!HeapTupleIsValid(tup))
|
if (!HeapTupleIsValid(tup))
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* it is possible for the input/output procedure to take two
|
* For array types, the input procedures may take 3 args
|
||||||
* arguments, where the second argument is the element type
|
* (data value, element OID, atttypmod); the pg_proc
|
||||||
* (eg array_in/array_out)
|
* argtype signature is 0,0,INT4OID. The output procedures
|
||||||
|
* may take 2 args (data value, element OID).
|
||||||
*/
|
*/
|
||||||
if (OidIsValid(elementObjectId))
|
if (OidIsValid(elementObjectId))
|
||||||
{
|
{
|
||||||
|
int nargs;
|
||||||
|
if (j % 2)
|
||||||
|
{
|
||||||
|
/* output proc */
|
||||||
|
nargs = 2;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
/* input proc */
|
||||||
|
nargs = 3;
|
||||||
|
argList[2] = INT4OID;
|
||||||
|
}
|
||||||
tup = SearchSysCacheTuple(PRONAME,
|
tup = SearchSysCacheTuple(PRONAME,
|
||||||
PointerGetDatum(procname),
|
PointerGetDatum(procname),
|
||||||
Int32GetDatum(2),
|
Int32GetDatum(nargs),
|
||||||
PointerGetDatum(argList),
|
PointerGetDatum(argList),
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: pg_proc.h,v 1.95 1999/04/13 17:28:35 momjian Exp $
|
* $Id: pg_proc.h,v 1.96 1999/04/20 03:51:13 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* The script catalog/genbki.sh reads this file and generates .bki
|
* The script catalog/genbki.sh reads this file and generates .bki
|
||||||
@ -1001,9 +1001,9 @@ DESCR("array");
|
|||||||
DATA(insert OID = 751 ( array_out PGUID 11 f t f 2 f 23 "0 0" 100 0 0 100 array_out - ));
|
DATA(insert OID = 751 ( array_out PGUID 11 f t f 2 f 23 "0 0" 100 0 0 100 array_out - ));
|
||||||
DESCR("array");
|
DESCR("array");
|
||||||
|
|
||||||
DATA(insert OID = 752 ( filename_in PGUID 11 f t f 2 f 605 "0" 100 0 0 100 filename_in - ));
|
DATA(insert OID = 752 ( filename_in PGUID 11 f t f 1 f 605 "0" 100 0 0 100 filename_in - ));
|
||||||
DESCR("(internal)");
|
DESCR("(internal)");
|
||||||
DATA(insert OID = 753 ( filename_out PGUID 11 f t f 2 f 19 "0" 100 0 0 100 filename_out - ));
|
DATA(insert OID = 753 ( filename_out PGUID 11 f t f 2 f 19 "0 0" 100 0 0 100 filename_out - ));
|
||||||
DESCR("(internal)");
|
DESCR("(internal)");
|
||||||
|
|
||||||
DATA(insert OID = 760 ( smgrin PGUID 11 f t f 1 f 210 "0" 100 0 0 100 smgrin - ));
|
DATA(insert OID = 760 ( smgrin PGUID 11 f t f 1 f 210 "0" 100 0 0 100 smgrin - ));
|
||||||
@ -1300,11 +1300,11 @@ DATA(insert OID = 1037 ( aclcontains PGUID 11 f t f 2 f 16 "1034 1033" 100 0
|
|||||||
DESCR("matches regex., case-sensitive");
|
DESCR("matches regex., case-sensitive");
|
||||||
DATA(insert OID = 1038 ( seteval PGUID 11 f t f 1 f 23 "26" 100 0 0 100 seteval - ));
|
DATA(insert OID = 1038 ( seteval PGUID 11 f t f 1 f 23 "26" 100 0 0 100 seteval - ));
|
||||||
DESCR("");
|
DESCR("");
|
||||||
DATA(insert OID = 1044 ( bpcharin PGUID 11 f t f 3 f 1042 "0" 100 0 0 100 bpcharin - ));
|
DATA(insert OID = 1044 ( bpcharin PGUID 11 f t f 3 f 1042 "0 0 23" 100 0 0 100 bpcharin - ));
|
||||||
DESCR("(internal)");
|
DESCR("(internal)");
|
||||||
DATA(insert OID = 1045 ( bpcharout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 bpcharout - ));
|
DATA(insert OID = 1045 ( bpcharout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 bpcharout - ));
|
||||||
DESCR("(internal)");
|
DESCR("(internal)");
|
||||||
DATA(insert OID = 1046 ( varcharin PGUID 11 f t f 3 f 1043 "0" 100 0 0 100 varcharin - ));
|
DATA(insert OID = 1046 ( varcharin PGUID 11 f t f 3 f 1043 "0 0 23" 100 0 0 100 varcharin - ));
|
||||||
DESCR("(internal)");
|
DESCR("(internal)");
|
||||||
DATA(insert OID = 1047 ( varcharout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 varcharout - ));
|
DATA(insert OID = 1047 ( varcharout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 varcharout - ));
|
||||||
DESCR("(internal)");
|
DESCR("(internal)");
|
||||||
|
@ -40,7 +40,7 @@ QUERY: SELECT p1.oid, p1.typname, p2.oid, p2.proname
|
|||||||
FROM pg_type AS p1, pg_proc AS p2
|
FROM pg_type AS p1, pg_proc AS p2
|
||||||
WHERE p1.typinput = p2.oid AND p1.typtype = 'b' AND
|
WHERE p1.typinput = p2.oid AND p1.typtype = 'b' AND
|
||||||
(p2.pronargs != 1 OR p2.proretset) AND
|
(p2.pronargs != 1 OR p2.proretset) AND
|
||||||
(p2.pronargs < 2 OR p2.pronargs > 3 OR p2.proretset OR p1.typelem = 0);
|
(p2.pronargs != 3 OR p2.proretset OR p1.typelem = 0);
|
||||||
oid|typname|oid|proname
|
oid|typname|oid|proname
|
||||||
---+-------+---+-------
|
---+-------+---+-------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
@ -58,7 +58,7 @@ QUERY: SELECT p1.oid, p1.typname, p2.oid, p2.proname
|
|||||||
FROM pg_type AS p1, pg_proc AS p2
|
FROM pg_type AS p1, pg_proc AS p2
|
||||||
WHERE p1.typreceive = p2.oid AND p1.typtype = 'b' AND
|
WHERE p1.typreceive = p2.oid AND p1.typtype = 'b' AND
|
||||||
(p2.pronargs != 1 OR p2.proretset) AND
|
(p2.pronargs != 1 OR p2.proretset) AND
|
||||||
(p2.pronargs < 2 OR p2.pronargs > 3 OR p2.proretset OR p1.typelem = 0);
|
(p2.pronargs != 3 OR p2.proretset OR p1.typelem = 0);
|
||||||
oid|typname|oid|proname
|
oid|typname|oid|proname
|
||||||
---+-------+---+-------
|
---+-------+---+-------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
@ -59,7 +59,7 @@ SELECT p1.oid, p1.typname, p2.oid, p2.proname
|
|||||||
FROM pg_type AS p1, pg_proc AS p2
|
FROM pg_type AS p1, pg_proc AS p2
|
||||||
WHERE p1.typinput = p2.oid AND p1.typtype = 'b' AND
|
WHERE p1.typinput = p2.oid AND p1.typtype = 'b' AND
|
||||||
(p2.pronargs != 1 OR p2.proretset) AND
|
(p2.pronargs != 1 OR p2.proretset) AND
|
||||||
(p2.pronargs < 2 OR p2.pronargs > 3 OR p2.proretset OR p1.typelem = 0);
|
(p2.pronargs != 3 OR p2.proretset OR p1.typelem = 0);
|
||||||
|
|
||||||
-- Check for bogus typoutput routines
|
-- Check for bogus typoutput routines
|
||||||
-- The first OR subclause detects bogus non-array cases,
|
-- The first OR subclause detects bogus non-array cases,
|
||||||
@ -83,7 +83,7 @@ SELECT p1.oid, p1.typname, p2.oid, p2.proname
|
|||||||
FROM pg_type AS p1, pg_proc AS p2
|
FROM pg_type AS p1, pg_proc AS p2
|
||||||
WHERE p1.typreceive = p2.oid AND p1.typtype = 'b' AND
|
WHERE p1.typreceive = p2.oid AND p1.typtype = 'b' AND
|
||||||
(p2.pronargs != 1 OR p2.proretset) AND
|
(p2.pronargs != 1 OR p2.proretset) AND
|
||||||
(p2.pronargs < 2 OR p2.pronargs > 3 OR p2.proretset OR p1.typelem = 0);
|
(p2.pronargs != 3 OR p2.proretset OR p1.typelem = 0);
|
||||||
|
|
||||||
-- Check for bogus typsend routines
|
-- Check for bogus typsend routines
|
||||||
-- The first OR subclause detects bogus non-array cases,
|
-- The first OR subclause detects bogus non-array cases,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user