Commit 45d04099 authored by Tom Lane's avatar Tom Lane

Reinstate pg_type's typsend and typreceive columns. They don't do much

yet, but they're there.  Also some editorial work on CREATE TYPE reference
page.
parent f2c7a276
<!-- <!--
Documentation of the system catalogs, directed toward PostgreSQL developers Documentation of the system catalogs, directed toward PostgreSQL developers
$Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.69 2003/04/15 13:23:35 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.70 2003/05/08 22:19:55 tgl Exp $
--> -->
<chapter id="catalogs"> <chapter id="catalogs">
...@@ -3315,9 +3315,9 @@ ...@@ -3315,9 +3315,9 @@
<para> <para>
The catalog <structname>pg_type</structname> stores information about data types. Base types The catalog <structname>pg_type</structname> stores information about data types. Base types
(scalar types) are created with <command>CREATE TYPE</command>. (scalar types) are created with <command>CREATE TYPE</command>.
A complex type is automatically created for each table in the database, to A composite type is automatically created for each table in the database, to
represent the row structure of the table. It is also possible to create represent the row structure of the table. It is also possible to create
complex types with <command>CREATE TYPE AS</command> and composite types with <command>CREATE TYPE AS</command> and
derived types with <command>CREATE DOMAIN</command>. derived types with <command>CREATE DOMAIN</command>.
</para> </para>
...@@ -3378,12 +3378,9 @@ ...@@ -3378,12 +3378,9 @@
<entry> <entry>
<structfield>typbyval</structfield> determines whether internal <structfield>typbyval</structfield> determines whether internal
routines pass a value of this type by value or by reference. routines pass a value of this type by value or by reference.
Only <type>char</type>, <type>short</type>, and <structfield>typbyval</structfield> had better be false if
<type>int</type> equivalent items can be passed by value, so if <structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
the type is not 1, 2, or 4 bytes long, where Datum is 8 bytes).
<productname>PostgreSQL</> does not have
the option of passing by value and so
<structfield>typbyval</structfield> had better be false.
Variable-length types are always passed by reference. Note that Variable-length types are always passed by reference. Note that
<structfield>typbyval</structfield> can be false even if the <structfield>typbyval</structfield> can be false even if the
length would allow pass-by-value; this is currently true for length would allow pass-by-value; this is currently true for
...@@ -3397,7 +3394,7 @@ ...@@ -3397,7 +3394,7 @@
<entry></entry> <entry></entry>
<entry> <entry>
<structfield>typtype</structfield> is <literal>b</literal> for <structfield>typtype</structfield> is <literal>b</literal> for
a base type, <literal>c</literal> for a complex type (i.e., a base type, <literal>c</literal> for a composite type (i.e.,
a table's row type), <literal>d</literal> for a derived type (i.e., a table's row type), <literal>d</literal> for a derived type (i.e.,
a domain), or <literal>p</literal> for a pseudo-type. See also a domain), or <literal>p</literal> for a pseudo-type. See also
<structfield>typrelid</structfield> <structfield>typrelid</structfield>
...@@ -3431,7 +3428,7 @@ ...@@ -3431,7 +3428,7 @@
<entry><type>oid</type></entry> <entry><type>oid</type></entry>
<entry><literal>pg_class.oid</literal></entry> <entry><literal>pg_class.oid</literal></entry>
<entry> <entry>
If this is a complex type (see If this is a composite type (see
<structfield>typtype</structfield>), then this column points to <structfield>typtype</structfield>), then this column points to
the <structname>pg_class</structname> entry that defines the the <structname>pg_class</structname> entry that defines the
corresponding table. (For a free-standing composite type, the corresponding table. (For a free-standing composite type, the
...@@ -3468,14 +3465,28 @@ ...@@ -3468,14 +3465,28 @@
<entry><structfield>typinput</structfield></entry> <entry><structfield>typinput</structfield></entry>
<entry><type>regproc</type></entry> <entry><type>regproc</type></entry>
<entry><literal>pg_proc.oid</literal></entry> <entry><literal>pg_proc.oid</literal></entry>
<entry>Input conversion function</entry> <entry>Input conversion function (text format)</entry>
</row> </row>
<row> <row>
<entry><structfield>typoutput</structfield></entry> <entry><structfield>typoutput</structfield></entry>
<entry><type>regproc</type></entry> <entry><type>regproc</type></entry>
<entry><literal>pg_proc.oid</literal></entry> <entry><literal>pg_proc.oid</literal></entry>
<entry>Output conversion function</entry> <entry>Output conversion function (text format)</entry>
</row>
<row>
<entry><structfield>typreceive</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal>pg_proc.oid</literal></entry>
<entry>Input conversion function (binary format), or 0 if none</entry>
</row>
<row>
<entry><structfield>typsend</structfield></entry>
<entry><type>regproc</type></entry>
<entry><literal>pg_proc.oid</literal></entry>
<entry>Output conversion function (binary format), or 0 if none</entry>
</row> </row>
<row> <row>
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.242 2003/04/29 22:13:08 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.243 2003/05/08 22:19:56 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -675,6 +675,8 @@ AddNewRelationType(const char *typeName, ...@@ -675,6 +675,8 @@ AddNewRelationType(const char *typeName,
',', /* default array delimiter */ ',', /* default array delimiter */
F_RECORD_IN, /* input procedure */ F_RECORD_IN, /* input procedure */
F_RECORD_OUT, /* output procedure */ F_RECORD_OUT, /* output procedure */
F_RECORD_RECV, /* receive procedure */
F_RECORD_SEND, /* send procedure */
InvalidOid, /* array element type - irrelevant */ InvalidOid, /* array element type - irrelevant */
InvalidOid, /* domain base type - irrelevant */ InvalidOid, /* domain base type - irrelevant */
NULL, /* default type value - none */ NULL, /* default type value - none */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.86 2003/01/08 21:40:39 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.87 2003/05/08 22:19:56 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -84,6 +84,8 @@ TypeShellMake(const char *typeName, Oid typeNamespace) ...@@ -84,6 +84,8 @@ TypeShellMake(const char *typeName, Oid typeNamespace)
values[i++] = ObjectIdGetDatum(InvalidOid); /* typelem */ values[i++] = ObjectIdGetDatum(InvalidOid); /* typelem */
values[i++] = ObjectIdGetDatum(InvalidOid); /* typinput */ values[i++] = ObjectIdGetDatum(InvalidOid); /* typinput */
values[i++] = ObjectIdGetDatum(InvalidOid); /* typoutput */ values[i++] = ObjectIdGetDatum(InvalidOid); /* typoutput */
values[i++] = ObjectIdGetDatum(InvalidOid); /* typreceive */
values[i++] = ObjectIdGetDatum(InvalidOid); /* typsend */
values[i++] = CharGetDatum('i'); /* typalign */ values[i++] = CharGetDatum('i'); /* typalign */
values[i++] = CharGetDatum('p'); /* typstorage */ values[i++] = CharGetDatum('p'); /* typstorage */
values[i++] = BoolGetDatum(false); /* typnotnull */ values[i++] = BoolGetDatum(false); /* typnotnull */
...@@ -117,6 +119,8 @@ TypeShellMake(const char *typeName, Oid typeNamespace) ...@@ -117,6 +119,8 @@ TypeShellMake(const char *typeName, Oid typeNamespace)
InvalidOid, InvalidOid,
InvalidOid, InvalidOid,
InvalidOid, InvalidOid,
InvalidOid,
InvalidOid,
NULL, NULL,
false); false);
...@@ -151,6 +155,8 @@ TypeCreate(const char *typeName, ...@@ -151,6 +155,8 @@ TypeCreate(const char *typeName,
char typDelim, char typDelim,
Oid inputProcedure, Oid inputProcedure,
Oid outputProcedure, Oid outputProcedure,
Oid receiveProcedure,
Oid sendProcedure,
Oid elementType, Oid elementType,
Oid baseType, Oid baseType,
const char *defaultTypeValue, /* human readable rep */ const char *defaultTypeValue, /* human readable rep */
...@@ -222,6 +228,8 @@ TypeCreate(const char *typeName, ...@@ -222,6 +228,8 @@ TypeCreate(const char *typeName,
values[i++] = ObjectIdGetDatum(elementType); /* typelem */ values[i++] = ObjectIdGetDatum(elementType); /* typelem */
values[i++] = ObjectIdGetDatum(inputProcedure); /* typinput */ values[i++] = ObjectIdGetDatum(inputProcedure); /* typinput */
values[i++] = ObjectIdGetDatum(outputProcedure); /* typoutput */ values[i++] = ObjectIdGetDatum(outputProcedure); /* typoutput */
values[i++] = ObjectIdGetDatum(receiveProcedure); /* typreceive */
values[i++] = ObjectIdGetDatum(sendProcedure); /* typsend */
values[i++] = CharGetDatum(alignment); /* typalign */ values[i++] = CharGetDatum(alignment); /* typalign */
values[i++] = CharGetDatum(storage); /* typstorage */ values[i++] = CharGetDatum(storage); /* typstorage */
values[i++] = BoolGetDatum(typeNotNull); /* typnotnull */ values[i++] = BoolGetDatum(typeNotNull); /* typnotnull */
...@@ -314,6 +322,8 @@ TypeCreate(const char *typeName, ...@@ -314,6 +322,8 @@ TypeCreate(const char *typeName,
relationKind, relationKind,
inputProcedure, inputProcedure,
outputProcedure, outputProcedure,
receiveProcedure,
sendProcedure,
elementType, elementType,
baseType, baseType,
(defaultTypeBin ? (defaultTypeBin ?
...@@ -345,6 +355,8 @@ GenerateTypeDependencies(Oid typeNamespace, ...@@ -345,6 +355,8 @@ GenerateTypeDependencies(Oid typeNamespace,
char relationKind, /* ditto */ char relationKind, /* ditto */
Oid inputProcedure, Oid inputProcedure,
Oid outputProcedure, Oid outputProcedure,
Oid receiveProcedure,
Oid sendProcedure,
Oid elementType, Oid elementType,
Oid baseType, Oid baseType,
Node *defaultExpr, Node *defaultExpr,
...@@ -388,6 +400,22 @@ GenerateTypeDependencies(Oid typeNamespace, ...@@ -388,6 +400,22 @@ GenerateTypeDependencies(Oid typeNamespace,
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
} }
if (OidIsValid(receiveProcedure))
{
referenced.classId = RelOid_pg_proc;
referenced.objectId = receiveProcedure;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}
if (OidIsValid(sendProcedure))
{
referenced.classId = RelOid_pg_proc;
referenced.objectId = sendProcedure;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}
/* /*
* If the type is a rowtype for a relation, mark it as internally * If the type is a rowtype for a relation, mark it as internally
* dependent on the relation, *unless* it is a stand-alone * dependent on the relation, *unless* it is a stand-alone
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.87 2003/04/08 23:20:02 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.88 2003/05/08 22:19:56 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -752,6 +752,34 @@ array_out(PG_FUNCTION_ARGS) ...@@ -752,6 +752,34 @@ array_out(PG_FUNCTION_ARGS)
PG_RETURN_CSTRING(retval); PG_RETURN_CSTRING(retval);
} }
/*---------------------------------------------------------------------
* array_recv :
* converts an array from the external binary format to
* its internal format.
* return value :
* the internal representation of the input array
*--------------------------------------------------------------------
*/
Datum
array_recv(PG_FUNCTION_ARGS)
{
elog(ERROR, "array_recv: not implemented yet");
return 0;
}
/*-------------------------------------------------------------------------
* array_send :
* takes the internal representation of an array and returns a bytea
* containing the array in its external binary format.
*-------------------------------------------------------------------------
*/
Datum
array_send(PG_FUNCTION_ARGS)
{
elog(ERROR, "array_send: not implemented yet");
return 0;
}
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* array_length_coerce : * array_length_coerce :
* Apply the element type's length-coercion routine to each element * Apply the element type's length-coercion routine to each element
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/pseudotypes.c,v 1.5 2003/04/08 23:20:02 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/pseudotypes.c,v 1.6 2003/05/08 22:19:56 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -48,6 +48,28 @@ record_out(PG_FUNCTION_ARGS) ...@@ -48,6 +48,28 @@ record_out(PG_FUNCTION_ARGS)
PG_RETURN_VOID(); /* keep compiler quiet */ PG_RETURN_VOID(); /* keep compiler quiet */
} }
/*
* record_recv - binary input routine for pseudo-type RECORD.
*/
Datum
record_recv(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot accept a constant of type %s", "RECORD");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/*
* record_send - binary output routine for pseudo-type RECORD.
*/
Datum
record_send(PG_FUNCTION_ARGS)
{
elog(ERROR, "Cannot display a value of type %s", "RECORD");
PG_RETURN_VOID(); /* keep compiler quiet */
}
/* /*
* cstring_in - input routine for pseudo-type CSTRING. * cstring_in - input routine for pseudo-type CSTRING.
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* by PostgreSQL * by PostgreSQL
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.328 2003/05/03 22:18:59 tgl Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.329 2003/05/08 22:19:56 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -3016,8 +3016,12 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo, ...@@ -3016,8 +3016,12 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
char *typlen; char *typlen;
char *typinput; char *typinput;
char *typoutput; char *typoutput;
char *typreceive;
char *typsend;
char *typinputoid; char *typinputoid;
char *typoutputoid; char *typoutputoid;
char *typreceiveoid;
char *typsendoid;
char *typdelim; char *typdelim;
char *typdefault; char *typdefault;
char *typbyval; char *typbyval;
...@@ -3032,12 +3036,28 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo, ...@@ -3032,12 +3036,28 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
selectSourceSchema(tinfo->typnamespace->nspname); selectSourceSchema(tinfo->typnamespace->nspname);
/* Fetch type-specific details */ /* Fetch type-specific details */
if (fout->remoteVersion >= 70300) if (fout->remoteVersion >= 70400)
{
appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, typreceive, typsend, "
"typinput::pg_catalog.oid as typinputoid, "
"typoutput::pg_catalog.oid as typoutputoid, "
"typreceive::pg_catalog.oid as typreceiveoid, "
"typsend::pg_catalog.oid as typsendoid, "
"typdelim, typdefault, typbyval, typalign, "
"typstorage "
"FROM pg_catalog.pg_type "
"WHERE oid = '%s'::pg_catalog.oid",
tinfo->oid);
}
else if (fout->remoteVersion >= 70300)
{ {
appendPQExpBuffer(query, "SELECT typlen, " appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, " "typinput, typoutput, "
"'-' as typreceive, '-' as typsend, "
"typinput::pg_catalog.oid as typinputoid, " "typinput::pg_catalog.oid as typinputoid, "
"typoutput::pg_catalog.oid as typoutputoid, " "typoutput::pg_catalog.oid as typoutputoid, "
"0 as typreceiveoid, 0 as typsendoid, "
"typdelim, typdefault, typbyval, typalign, " "typdelim, typdefault, typbyval, typalign, "
"typstorage " "typstorage "
"FROM pg_catalog.pg_type " "FROM pg_catalog.pg_type "
...@@ -3046,10 +3066,16 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo, ...@@ -3046,10 +3066,16 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
} }
else if (fout->remoteVersion >= 70100) else if (fout->remoteVersion >= 70100)
{ {
/*
* Note: although pre-7.3 catalogs contain typreceive and typsend,
* ignore them because they are not right.
*/
appendPQExpBuffer(query, "SELECT typlen, " appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, " "typinput, typoutput, "
"'-' as typreceive, '-' as typsend, "
"typinput::oid as typinputoid, " "typinput::oid as typinputoid, "
"typoutput::oid as typoutputoid, " "typoutput::oid as typoutputoid, "
"0 as typreceiveoid, 0 as typsendoid, "
"typdelim, typdefault, typbyval, typalign, " "typdelim, typdefault, typbyval, typalign, "
"typstorage " "typstorage "
"FROM pg_type " "FROM pg_type "
...@@ -3060,8 +3086,10 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo, ...@@ -3060,8 +3086,10 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
{ {
appendPQExpBuffer(query, "SELECT typlen, " appendPQExpBuffer(query, "SELECT typlen, "
"typinput, typoutput, " "typinput, typoutput, "
"'-' as typreceive, '-' as typsend, "
"typinput::oid as typinputoid, " "typinput::oid as typinputoid, "
"typoutput::oid as typoutputoid, " "typoutput::oid as typoutputoid, "
"0 as typreceiveoid, 0 as typsendoid, "
"typdelim, typdefault, typbyval, typalign, " "typdelim, typdefault, typbyval, typalign, "
"'p'::char as typstorage " "'p'::char as typstorage "
"FROM pg_type " "FROM pg_type "
...@@ -3090,8 +3118,12 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo, ...@@ -3090,8 +3118,12 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
typlen = PQgetvalue(res, 0, PQfnumber(res, "typlen")); typlen = PQgetvalue(res, 0, PQfnumber(res, "typlen"));
typinput = PQgetvalue(res, 0, PQfnumber(res, "typinput")); typinput = PQgetvalue(res, 0, PQfnumber(res, "typinput"));
typoutput = PQgetvalue(res, 0, PQfnumber(res, "typoutput")); typoutput = PQgetvalue(res, 0, PQfnumber(res, "typoutput"));
typreceive = PQgetvalue(res, 0, PQfnumber(res, "typreceive"));
typsend = PQgetvalue(res, 0, PQfnumber(res, "typsend"));
typinputoid = PQgetvalue(res, 0, PQfnumber(res, "typinputoid")); typinputoid = PQgetvalue(res, 0, PQfnumber(res, "typinputoid"));
typoutputoid = PQgetvalue(res, 0, PQfnumber(res, "typoutputoid")); typoutputoid = PQgetvalue(res, 0, PQfnumber(res, "typoutputoid"));
typreceiveoid = PQgetvalue(res, 0, PQfnumber(res, "typreceiveoid"));
typsendoid = PQgetvalue(res, 0, PQfnumber(res, "typsendoid"));
typdelim = PQgetvalue(res, 0, PQfnumber(res, "typdelim")); typdelim = PQgetvalue(res, 0, PQfnumber(res, "typdelim"));
if (PQgetisnull(res, 0, PQfnumber(res, "typdefault"))) if (PQgetisnull(res, 0, PQfnumber(res, "typdefault")))
typdefault = NULL; typdefault = NULL;
...@@ -3115,6 +3147,20 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo, ...@@ -3115,6 +3147,20 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
if (funcInd >= 0 && g_finfo[funcInd].pronamespace->dump) if (funcInd >= 0 && g_finfo[funcInd].pronamespace->dump)
(*deps)[depIdx++] = strdup(typoutputoid); (*deps)[depIdx++] = strdup(typoutputoid);
if (strcmp(typreceiveoid, "0") != 0)
{
funcInd = findFuncByOid(g_finfo, numFuncs, typreceiveoid);
if (funcInd >= 0 && g_finfo[funcInd].pronamespace->dump)
(*deps)[depIdx++] = strdup(typreceiveoid);
}
if (strcmp(typsendoid, "0") != 0)
{
funcInd = findFuncByOid(g_finfo, numFuncs, typsendoid);
if (funcInd >= 0 && g_finfo[funcInd].pronamespace->dump)
(*deps)[depIdx++] = strdup(typsendoid);
}
/* /*
* DROP must be fully qualified in case same name appears in * DROP must be fully qualified in case same name appears in
* pg_catalog * pg_catalog
...@@ -3126,24 +3172,27 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo, ...@@ -3126,24 +3172,27 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
appendPQExpBuffer(q, appendPQExpBuffer(q,
"CREATE TYPE %s (\n" "CREATE TYPE %s (\n"
" INTERNALLENGTH = %s,\n", " INTERNALLENGTH = %s",
fmtId(tinfo->typname), fmtId(tinfo->typname),
(strcmp(typlen, "-1") == 0) ? "variable" : typlen); (strcmp(typlen, "-1") == 0) ? "variable" : typlen);
if (fout->remoteVersion >= 70300) if (fout->remoteVersion >= 70300)
{ {
/* regproc result is correctly quoted in 7.3 */ /* regproc result is correctly quoted in 7.3 */
appendPQExpBuffer(q, " INPUT = %s,\n OUTPUT = %s", appendPQExpBuffer(q, ",\n INPUT = %s", typinput);
typinput, typoutput); appendPQExpBuffer(q, ",\n OUTPUT = %s", typoutput);
if (strcmp(typreceiveoid, "0") != 0)
appendPQExpBuffer(q, ",\n RECEIVE = %s", typreceive);
if (strcmp(typsendoid, "0") != 0)
appendPQExpBuffer(q, ",\n SEND = %s", typsend);
} }
else else
{ {
/* regproc delivers an unquoted name before 7.3 */ /* regproc delivers an unquoted name before 7.3 */
/* cannot combine these because fmtId uses static result area */ /* cannot combine these because fmtId uses static result area */
appendPQExpBuffer(q, " INPUT = %s,\n", appendPQExpBuffer(q, ",\n INPUT = %s", fmtId(typinput));
fmtId(typinput)); appendPQExpBuffer(q, ",\n OUTPUT = %s", fmtId(typoutput));
appendPQExpBuffer(q, " OUTPUT = %s", /* no chance that receive/send need be printed */
fmtId(typoutput));
} }
if (typdefault != NULL) if (typdefault != NULL)
...@@ -3159,13 +3208,18 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo, ...@@ -3159,13 +3208,18 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
/* reselect schema in case changed by function dump */ /* reselect schema in case changed by function dump */
selectSourceSchema(tinfo->typnamespace->nspname); selectSourceSchema(tinfo->typnamespace->nspname);
elemType = getFormattedTypeName(tinfo->typelem, zeroAsOpaque); elemType = getFormattedTypeName(tinfo->typelem, zeroAsOpaque);
appendPQExpBuffer(q, ",\n ELEMENT = %s,\n DELIMITER = ", elemType); appendPQExpBuffer(q, ",\n ELEMENT = %s", elemType);
appendStringLiteral(q, typdelim, true);
free(elemType); free(elemType);
(*deps)[depIdx++] = strdup(tinfo->typelem); (*deps)[depIdx++] = strdup(tinfo->typelem);
} }
if (typdelim && strcmp(typdelim, ",") != 0)
{
appendPQExpBuffer(q, ",\n DELIMITER = ");
appendStringLiteral(q, typdelim, true);
}
if (strcmp(typalign, "c") == 0) if (strcmp(typalign, "c") == 0)
appendPQExpBuffer(q, ",\n ALIGNMENT = char"); appendPQExpBuffer(q, ",\n ALIGNMENT = char");
else if (strcmp(typalign, "s") == 0) else if (strcmp(typalign, "s") == 0)
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: catversion.h,v 1.186 2003/05/06 00:20:33 tgl Exp $ * $Id: catversion.h,v 1.187 2003/05/08 22:19:56 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 200305051 #define CATALOG_VERSION_NO 200305081
#endif #endif
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_attribute.h,v 1.101 2003/03/10 22:28:19 tgl Exp $ * $Id: pg_attribute.h,v 1.102 2003/05/08 22:19:56 tgl Exp $
* *
* NOTES * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -238,14 +238,16 @@ typedef FormData_pg_attribute *Form_pg_attribute; ...@@ -238,14 +238,16 @@ typedef FormData_pg_attribute *Form_pg_attribute;
{ 1247, {"typelem"}, 26, 0, 4, 10, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \ { 1247, {"typelem"}, 26, 0, 4, 10, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \
{ 1247, {"typinput"}, 24, 0, 4, 11, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \ { 1247, {"typinput"}, 24, 0, 4, 11, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \
{ 1247, {"typoutput"}, 24, 0, 4, 12, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \ { 1247, {"typoutput"}, 24, 0, 4, 12, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \
{ 1247, {"typalign"}, 18, 0, 1, 13, 0, -1, -1, true, 'p', false, 'c', true, false, false, true, 0 }, \ { 1247, {"typreceive"}, 24, 0, 4, 13, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \
{ 1247, {"typstorage"}, 18, 0, 1, 14, 0, -1, -1, true, 'p', false, 'c', true, false, false, true, 0 }, \ { 1247, {"typsend"}, 24, 0, 4, 14, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \
{ 1247, {"typnotnull"}, 16, 0, 1, 15, 0, -1, -1, true, 'p', false, 'c', true, false, false, true, 0 }, \ { 1247, {"typalign"}, 18, 0, 1, 15, 0, -1, -1, true, 'p', false, 'c', true, false, false, true, 0 }, \
{ 1247, {"typbasetype"}, 26, 0, 4, 16, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \ { 1247, {"typstorage"}, 18, 0, 1, 16, 0, -1, -1, true, 'p', false, 'c', true, false, false, true, 0 }, \
{ 1247, {"typtypmod"}, 23, 0, 4, 17, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \ { 1247, {"typnotnull"}, 16, 0, 1, 17, 0, -1, -1, true, 'p', false, 'c', true, false, false, true, 0 }, \
{ 1247, {"typndims"}, 23, 0, 4, 18, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \ { 1247, {"typbasetype"}, 26, 0, 4, 18, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \
{ 1247, {"typdefaultbin"}, 25, 0, -1, 19, 0, -1, -1, false, 'x', false, 'i', false, false, false, true, 0 }, \ { 1247, {"typtypmod"}, 23, 0, 4, 19, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \
{ 1247, {"typdefault"}, 25, 0, -1, 20, 0, -1, -1, false, 'x', false, 'i', false, false, false, true, 0 } { 1247, {"typndims"}, 23, 0, 4, 20, 0, -1, -1, true, 'p', false, 'i', true, false, false, true, 0 }, \
{ 1247, {"typdefaultbin"}, 25, 0, -1, 21, 0, -1, -1, false, 'x', false, 'i', false, false, false, true, 0 }, \
{ 1247, {"typdefault"}, 25, 0, -1, 22, 0, -1, -1, false, 'x', false, 'i', false, false, false, true, 0 }
DATA(insert ( 1247 typname 19 -1 NAMEDATALEN 1 0 -1 -1 f p f i t f f t 0)); DATA(insert ( 1247 typname 19 -1 NAMEDATALEN 1 0 -1 -1 f p f i t f f t 0));
...@@ -260,14 +262,16 @@ DATA(insert ( 1247 typrelid 26 0 4 9 0 -1 -1 t p f i t f f t 0)); ...@@ -260,14 +262,16 @@ DATA(insert ( 1247 typrelid 26 0 4 9 0 -1 -1 t p f i t f f t 0));
DATA(insert ( 1247 typelem 26 0 4 10 0 -1 -1 t p f i t f f t 0)); DATA(insert ( 1247 typelem 26 0 4 10 0 -1 -1 t p f i t f f t 0));
DATA(insert ( 1247 typinput 24 0 4 11 0 -1 -1 t p f i t f f t 0)); DATA(insert ( 1247 typinput 24 0 4 11 0 -1 -1 t p f i t f f t 0));
DATA(insert ( 1247 typoutput 24 0 4 12 0 -1 -1 t p f i t f f t 0)); DATA(insert ( 1247 typoutput 24 0 4 12 0 -1 -1 t p f i t f f t 0));
DATA(insert ( 1247 typalign 18 0 1 13 0 -1 -1 t p f c t f f t 0)); DATA(insert ( 1247 typreceive 24 0 4 13 0 -1 -1 t p f i t f f t 0));
DATA(insert ( 1247 typstorage 18 0 1 14 0 -1 -1 t p f c t f f t 0)); DATA(insert ( 1247 typsend 24 0 4 14 0 -1 -1 t p f i t f f t 0));
DATA(insert ( 1247 typnotnull 16 0 1 15 0 -1 -1 t p f c t f f t 0)); DATA(insert ( 1247 typalign 18 0 1 15 0 -1 -1 t p f c t f f t 0));
DATA(insert ( 1247 typbasetype 26 0 4 16 0 -1 -1 t p f i t f f t 0)); DATA(insert ( 1247 typstorage 18 0 1 16 0 -1 -1 t p f c t f f t 0));
DATA(insert ( 1247 typtypmod 23 0 4 17 0 -1 -1 t p f i t f f t 0)); DATA(insert ( 1247 typnotnull 16 0 1 17 0 -1 -1 t p f c t f f t 0));
DATA(insert ( 1247 typndims 23 0 4 18 0 -1 -1 t p f i t f f t 0)); DATA(insert ( 1247 typbasetype 26 0 4 18 0 -1 -1 t p f i t f f t 0));
DATA(insert ( 1247 typdefaultbin 25 0 -1 19 0 -1 -1 f x f i f f f t 0)); DATA(insert ( 1247 typtypmod 23 0 4 19 0 -1 -1 t p f i t f f t 0));
DATA(insert ( 1247 typdefault 25 0 -1 20 0 -1 -1 f x f i f f f t 0)); DATA(insert ( 1247 typndims 23 0 4 20 0 -1 -1 t p f i t f f t 0));
DATA(insert ( 1247 typdefaultbin 25 0 -1 21 0 -1 -1 f x f i f f f t 0));
DATA(insert ( 1247 typdefault 25 0 -1 22 0 -1 -1 f x f i f f f t 0));
DATA(insert ( 1247 ctid 27 0 6 -1 0 -1 -1 f p f i t f f t 0)); DATA(insert ( 1247 ctid 27 0 6 -1 0 -1 -1 f p f i t f f t 0));
DATA(insert ( 1247 oid 26 0 4 -2 0 -1 -1 t p f i t f f t 0)); DATA(insert ( 1247 oid 26 0 4 -2 0 -1 -1 t p f i t f f t 0));
DATA(insert ( 1247 xmin 28 0 4 -3 0 -1 -1 t p f i t f f t 0)); DATA(insert ( 1247 xmin 28 0 4 -3 0 -1 -1 t p f i t f f t 0));
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_class.h,v 1.75 2003/03/10 22:28:19 tgl Exp $ * $Id: pg_class.h,v 1.76 2003/05/08 22:19:57 tgl Exp $
* *
* NOTES * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -134,7 +134,7 @@ typedef FormData_pg_class *Form_pg_class; ...@@ -134,7 +134,7 @@ typedef FormData_pg_class *Form_pg_class;
* ---------------- * ----------------
*/ */
DATA(insert OID = 1247 ( pg_type PGNSP 71 PGUID 0 1247 0 0 0 0 f f r 20 0 0 0 0 0 t f f f _null_ )); DATA(insert OID = 1247 ( pg_type PGNSP 71 PGUID 0 1247 0 0 0 0 f f r 22 0 0 0 0 0 t f f f _null_ ));
DESCR(""); DESCR("");
DATA(insert OID = 1249 ( pg_attribute PGNSP 75 PGUID 0 1249 0 0 0 0 f f r 18 0 0 0 0 0 f f f f _null_ )); DATA(insert OID = 1249 ( pg_attribute PGNSP 75 PGUID 0 1249 0 0 0 0 f f r 18 0 0 0 0 0 f f f f _null_ ));
DESCR(""); DESCR("");
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_proc.h,v 1.293 2003/04/17 04:50:20 tgl Exp $ * $Id: pg_proc.h,v 1.294 2003/05/08 22:19:57 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
...@@ -993,9 +993,9 @@ DESCR("session user name"); ...@@ -993,9 +993,9 @@ DESCR("session user name");
DATA(insert OID = 747 ( array_dims PGNSP PGUID 12 f f t f i 1 25 "2277" array_dims - _null_ )); DATA(insert OID = 747 ( array_dims PGNSP PGUID 12 f f t f i 1 25 "2277" array_dims - _null_ ));
DESCR("array dimensions"); DESCR("array dimensions");
DATA(insert OID = 750 ( array_in PGNSP PGUID 12 f f t f s 3 2277 "2275 26 23" array_in - _null_ )); DATA(insert OID = 750 ( array_in PGNSP PGUID 12 f f t f s 3 2277 "2275 26 23" array_in - _null_ ));
DESCR("array"); DESCR("I/O");
DATA(insert OID = 751 ( array_out PGNSP PGUID 12 f f t f s 1 2275 "2277" array_out - _null_ )); DATA(insert OID = 751 ( array_out PGNSP PGUID 12 f f t f s 1 2275 "2277" array_out - _null_ ));
DESCR("array"); DESCR("I/O");
DATA(insert OID = 2091 ( array_lower PGNSP PGUID 12 f f t f i 2 23 "2277 23" array_lower - _null_ )); DATA(insert OID = 2091 ( array_lower PGNSP PGUID 12 f f t f i 2 23 "2277 23" array_lower - _null_ ));
DESCR("array lower dimension"); DESCR("array lower dimension");
DATA(insert OID = 2092 ( array_upper PGNSP PGUID 12 f f t f i 2 23 "2277 23" array_upper - _null_ )); DATA(insert OID = 2092 ( array_upper PGNSP PGUID 12 f f t f i 2 23 "2277 23" array_upper - _null_ ));
...@@ -3153,6 +3153,16 @@ DATA(insert OID = 2311 ( md5 PGNSP PGUID 12 f f t f i 1 25 "25" md5_text - ...@@ -3153,6 +3153,16 @@ DATA(insert OID = 2311 ( md5 PGNSP PGUID 12 f f t f i 1 25 "25" md5_text -
DESCR("calculates md5 hash"); DESCR("calculates md5 hash");
DATA(insert OID = 2400 ( array_recv PGNSP PGUID 12 f f t f s 1 2277 "2281" array_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2401 ( array_send PGNSP PGUID 12 f f t f s 1 17 "2277" array_send - _null_ ));
DESCR("I/O");
DATA(insert OID = 2402 ( record_recv PGNSP PGUID 12 f f t f i 1 2249 "2281" record_recv - _null_ ));
DESCR("I/O");
DATA(insert OID = 2403 ( record_send PGNSP PGUID 12 f f t f i 1 17 "2249" record_send - _null_ ));
DESCR("I/O");
/* /*
* Symbolic values for provolatile column: these indicate whether the result * Symbolic values for provolatile column: these indicate whether the result
* of a function is dependent *only* on the values of its explicit arguments, * of a function is dependent *only* on the values of its explicit arguments,
......
This diff is collapsed.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: array.h,v 1.37 2003/04/08 23:20:04 tgl Exp $ * $Id: array.h,v 1.38 2003/05/08 22:19:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -82,6 +82,8 @@ typedef struct ...@@ -82,6 +82,8 @@ typedef struct
*/ */
extern Datum array_in(PG_FUNCTION_ARGS); extern Datum array_in(PG_FUNCTION_ARGS);
extern Datum array_out(PG_FUNCTION_ARGS); extern Datum array_out(PG_FUNCTION_ARGS);
extern Datum array_recv(PG_FUNCTION_ARGS);
extern Datum array_send(PG_FUNCTION_ARGS);
extern Datum array_length_coerce(PG_FUNCTION_ARGS); extern Datum array_length_coerce(PG_FUNCTION_ARGS);
extern Datum array_eq(PG_FUNCTION_ARGS); extern Datum array_eq(PG_FUNCTION_ARGS);
extern Datum array_dims(PG_FUNCTION_ARGS); extern Datum array_dims(PG_FUNCTION_ARGS);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: builtins.h,v 1.211 2003/04/08 23:20:04 tgl Exp $ * $Id: builtins.h,v 1.212 2003/05/08 22:19:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -346,6 +346,8 @@ extern Datum oidvectorgt(PG_FUNCTION_ARGS); ...@@ -346,6 +346,8 @@ extern Datum oidvectorgt(PG_FUNCTION_ARGS);
/* pseudotypes.c */ /* pseudotypes.c */
extern Datum record_in(PG_FUNCTION_ARGS); extern Datum record_in(PG_FUNCTION_ARGS);
extern Datum record_out(PG_FUNCTION_ARGS); extern Datum record_out(PG_FUNCTION_ARGS);
extern Datum record_recv(PG_FUNCTION_ARGS);
extern Datum record_send(PG_FUNCTION_ARGS);
extern Datum cstring_in(PG_FUNCTION_ARGS); extern Datum cstring_in(PG_FUNCTION_ARGS);
extern Datum cstring_out(PG_FUNCTION_ARGS); extern Datum cstring_out(PG_FUNCTION_ARGS);
extern Datum any_in(PG_FUNCTION_ARGS); extern Datum any_in(PG_FUNCTION_ARGS);
......
...@@ -537,3 +537,19 @@ WHERE typoutput != 0 AND ...@@ -537,3 +537,19 @@ WHERE typoutput != 0 AND
------+----------- ------+-----------
(0 rows) (0 rows)
SELECT ctid, typreceive
FROM pg_catalog.pg_type fk
WHERE typreceive != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typreceive);
ctid | typreceive
------+------------
(0 rows)
SELECT ctid, typsend
FROM pg_catalog.pg_type fk
WHERE typsend != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typsend);
ctid | typsend
------+---------
(0 rows)
...@@ -139,6 +139,53 @@ WHERE p1.typoutput = p2.oid AND p1.typtype in ('b', 'p') AND NOT ...@@ -139,6 +139,53 @@ WHERE p1.typoutput = p2.oid AND p1.typtype in ('b', 'p') AND NOT
-----+---------+-----+--------- -----+---------+-----+---------
(0 rows) (0 rows)
-- Check for bogus typreceive routines
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typreceive = p2.oid AND p1.typtype in ('b', 'p') AND NOT
(p2.pronargs = 1 AND p2.proargtypes[0] = 'internal'::regtype);
oid | typname | oid | proname
-----+---------+-----+---------
(0 rows)
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typreceive = p2.oid AND p1.typtype in ('b', 'p') AND NOT
(p1.typelem != 0 AND p1.typlen < 0) AND NOT
(p2.prorettype = p1.oid AND NOT p2.proretset);
oid | typname | oid | proname
-----+---------+-----+---------
(0 rows)
-- Varlena array types will point to array_recv
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typreceive = p2.oid AND p1.typtype in ('b', 'p') AND
(p1.typelem != 0 AND p1.typlen < 0) AND NOT
(p2.oid = 'array_recv'::regproc);
oid | typname | oid | proname
-----+---------+-----+---------
(0 rows)
-- Check for bogus typsend routines
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typsend = p2.oid AND p1.typtype in ('b', 'p') AND NOT
((p2.pronargs = 1 AND p2.proargtypes[0] = p1.oid) OR
(p2.oid = 'array_send'::regproc AND
p1.typelem != 0 AND p1.typlen = -1));
oid | typname | oid | proname
-----+---------+-----+---------
(0 rows)
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typsend = p2.oid AND p1.typtype in ('b', 'p') AND NOT
(p2.prorettype = 'bytea'::regtype AND NOT p2.proretset);
oid | typname | oid | proname
-----+---------+-----+---------
(0 rows)
-- **************** pg_class **************** -- **************** pg_class ****************
-- Look for illegal values in pg_class fields -- Look for illegal values in pg_class fields
SELECT p1.oid, p1.relname SELECT p1.oid, p1.relname
......
...@@ -269,3 +269,11 @@ SELECT ctid, typoutput ...@@ -269,3 +269,11 @@ SELECT ctid, typoutput
FROM pg_catalog.pg_type fk FROM pg_catalog.pg_type fk
WHERE typoutput != 0 AND WHERE typoutput != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typoutput); NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typoutput);
SELECT ctid, typreceive
FROM pg_catalog.pg_type fk
WHERE typreceive != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typreceive);
SELECT ctid, typsend
FROM pg_catalog.pg_type fk
WHERE typsend != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typsend);
...@@ -109,6 +109,40 @@ FROM pg_type AS p1, pg_proc AS p2 ...@@ -109,6 +109,40 @@ FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typoutput = p2.oid AND p1.typtype in ('b', 'p') AND NOT WHERE p1.typoutput = p2.oid AND p1.typtype in ('b', 'p') AND NOT
(p2.prorettype = 'cstring'::regtype AND NOT p2.proretset); (p2.prorettype = 'cstring'::regtype AND NOT p2.proretset);
-- Check for bogus typreceive routines
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typreceive = p2.oid AND p1.typtype in ('b', 'p') AND NOT
(p2.pronargs = 1 AND p2.proargtypes[0] = 'internal'::regtype);
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typreceive = p2.oid AND p1.typtype in ('b', 'p') AND NOT
(p1.typelem != 0 AND p1.typlen < 0) AND NOT
(p2.prorettype = p1.oid AND NOT p2.proretset);
-- Varlena array types will point to array_recv
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typreceive = p2.oid AND p1.typtype in ('b', 'p') AND
(p1.typelem != 0 AND p1.typlen < 0) AND NOT
(p2.oid = 'array_recv'::regproc);
-- Check for bogus typsend routines
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typsend = p2.oid AND p1.typtype in ('b', 'p') AND NOT
((p2.pronargs = 1 AND p2.proargtypes[0] = p1.oid) OR
(p2.oid = 'array_send'::regproc AND
p1.typelem != 0 AND p1.typlen = -1));
SELECT p1.oid, p1.typname, p2.oid, p2.proname
FROM pg_type AS p1, pg_proc AS p2
WHERE p1.typsend = p2.oid AND p1.typtype in ('b', 'p') AND NOT
(p2.prorettype = 'bytea'::regtype AND NOT p2.proretset);
-- **************** pg_class **************** -- **************** pg_class ****************
-- Look for illegal values in pg_class fields -- Look for illegal values in pg_class fields
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment