summaryrefslogtreecommitdiff
path: root/src/backend/access/common/printtup.c
diff options
context:
space:
mode:
authorTom Lane2006-04-05 22:11:58 +0000
committerTom Lane2006-04-05 22:11:58 +0000
commit7fdb4305db20f64bce27e6bac0a0f9c972e4dec8 (patch)
tree18efa90dfcf996675cf1c7bb938d8575f7e551ad /src/backend/access/common/printtup.c
parent89a67e523e744eb168b41d192b83d17a395b4137 (diff)
Fix a bunch of problems with domains by making them use special input functions
that apply the necessary domain constraint checks immediately. This fixes cases where domain constraints went unchecked for statement parameters, PL function local variables and results, etc. We can also eliminate existing special cases for domains in places that had gotten it right, eg COPY. Also, allow domains over domains (base of a domain is another domain type). This almost worked before, but was disallowed because the original patch hadn't gotten it quite right.
Diffstat (limited to 'src/backend/access/common/printtup.c')
-rw-r--r--src/backend/access/common/printtup.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index ba5793b0e7e..7eb46bb6ec5 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.95 2006/04/04 19:35:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.96 2006/04/05 22:11:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,7 +177,6 @@ SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist, int16 *formats)
{
Oid atttypid = attrs[i]->atttypid;
int32 atttypmod = attrs[i]->atttypmod;
- Oid basetype;
pq_sendstring(&buf, NameStr(attrs[i]->attname));
/* column ID info appears in protocol 3.0 and up */
@@ -203,12 +202,7 @@ SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist, int16 *formats)
}
}
/* If column is a domain, send the base type and typmod instead */
- basetype = getBaseType(atttypid);
- if (basetype != atttypid)
- {
- atttypmod = get_typtypmod(atttypid);
- atttypid = basetype;
- }
+ atttypid = getBaseTypeAndTypmod(atttypid, &atttypmod);
pq_sendint(&buf, (int) atttypid, sizeof(atttypid));
pq_sendint(&buf, attrs[i]->attlen, sizeof(attrs[i]->attlen));
/* typmod appears in protocol 2.0 and up */