Commit dc4e983f authored by Tom Lane's avatar Tom Lane

Produce a somewhat-useful error message, namely

ERROR:  Cannot display a value of type RECORD
rather than a random integer when someone tries to SELECT a tuple
value.  Per pghackers discussion around 26-May-02.
parent 99fd5cbd
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.222 2002/08/29 00:17:02 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.223 2002/08/29 04:38:04 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -623,6 +623,12 @@ AddNewRelationType(const char *typeName, ...@@ -623,6 +623,12 @@ AddNewRelationType(const char *typeName,
Oid new_type_oid) Oid new_type_oid)
{ {
/* /*
* We set the I/O procedures of a complex type to record_in and
* record_out, so that a user will get an error message not a weird
* number if he tries to SELECT a complex type.
*
* OLD and probably obsolete comments:
*
* The sizes are set to oid size because it makes implementing sets * The sizes are set to oid size because it makes implementing sets
* MUCH easier, and no one (we hope) uses these fields to figure out * MUCH easier, and no one (we hope) uses these fields to figure out
* how much space to allocate for the type. An oid is the type used * how much space to allocate for the type. An oid is the type used
...@@ -639,8 +645,8 @@ AddNewRelationType(const char *typeName, ...@@ -639,8 +645,8 @@ AddNewRelationType(const char *typeName,
sizeof(Oid), /* internal size */ sizeof(Oid), /* internal size */
'c', /* type-type (complex) */ 'c', /* type-type (complex) */
',', /* default array delimiter */ ',', /* default array delimiter */
F_OIDIN, /* input procedure */ F_RECORD_IN, /* input procedure */
F_OIDOUT, /* output procedure */ F_RECORD_OUT, /* output 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 @@
* 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_type.h,v 1.131 2002/08/29 00:17:06 tgl Exp $ * $Id: pg_type.h,v 1.132 2002/08/29 04:38:04 tgl Exp $
* *
* NOTES * NOTES
* the genbki.sh script reads this file and generates .bki * the genbki.sh script reads this file and generates .bki
...@@ -296,13 +296,13 @@ DESCR("array of INDEX_MAX_KEYS oids, used in system tables"); ...@@ -296,13 +296,13 @@ DESCR("array of INDEX_MAX_KEYS oids, used in system tables");
DATA(insert OID = 32 ( SET PGNSP PGUID -1 f b t \054 0 0 unknownin unknownout i p f 0 -1 0 _null_ _null_ )); DATA(insert OID = 32 ( SET PGNSP PGUID -1 f b t \054 0 0 unknownin unknownout i p f 0 -1 0 _null_ _null_ ));
DESCR("set of tuples"); DESCR("set of tuples");
DATA(insert OID = 71 ( pg_type PGNSP PGUID 4 t c t \054 1247 0 int4in int4out i p f 0 -1 0 _null_ _null_ )); DATA(insert OID = 71 ( pg_type PGNSP PGUID 4 t c t \054 1247 0 record_in record_out i p f 0 -1 0 _null_ _null_ ));
DATA(insert OID = 75 ( pg_attribute PGNSP PGUID 4 t c t \054 1249 0 int4in int4out i p f 0 -1 0 _null_ _null_ )); DATA(insert OID = 75 ( pg_attribute PGNSP PGUID 4 t c t \054 1249 0 record_in record_out i p f 0 -1 0 _null_ _null_ ));
DATA(insert OID = 81 ( pg_proc PGNSP PGUID 4 t c t \054 1255 0 int4in int4out i p f 0 -1 0 _null_ _null_ )); DATA(insert OID = 81 ( pg_proc PGNSP PGUID 4 t c t \054 1255 0 record_in record_out i p f 0 -1 0 _null_ _null_ ));
DATA(insert OID = 83 ( pg_class PGNSP PGUID 4 t c t \054 1259 0 int4in int4out i p f 0 -1 0 _null_ _null_ )); DATA(insert OID = 83 ( pg_class PGNSP PGUID 4 t c t \054 1259 0 record_in record_out i p f 0 -1 0 _null_ _null_ ));
DATA(insert OID = 86 ( pg_shadow PGNSP PGUID 4 t c t \054 1260 0 int4in int4out i p f 0 -1 0 _null_ _null_ )); DATA(insert OID = 86 ( pg_shadow PGNSP PGUID 4 t c t \054 1260 0 record_in record_out i p f 0 -1 0 _null_ _null_ ));
DATA(insert OID = 87 ( pg_group PGNSP PGUID 4 t c t \054 1261 0 int4in int4out i p f 0 -1 0 _null_ _null_ )); DATA(insert OID = 87 ( pg_group PGNSP PGUID 4 t c t \054 1261 0 record_in record_out i p f 0 -1 0 _null_ _null_ ));
DATA(insert OID = 88 ( pg_database PGNSP PGUID 4 t c t \054 1262 0 int4in int4out i p f 0 -1 0 _null_ _null_ )); DATA(insert OID = 88 ( pg_database PGNSP PGUID 4 t c t \054 1262 0 record_in record_out i p f 0 -1 0 _null_ _null_ ));
/* OIDS 100 - 199 */ /* OIDS 100 - 199 */
......
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