summaryrefslogtreecommitdiff
path: root/src/backend/nodes
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-12-30 21:21:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-12-30 21:21:56 +0000
commit5725b9d9afc8c3ba24e94cbc7020889fe8ad7ef9 (patch)
treee1c8a77dbb660fa0de36528f19dc4f3cb81829d2 /src/backend/nodes
parent24b1f14eae0b83ef5d6b269ebf1ecae2f3acbb8c (diff)
downloadpostgresql-5725b9d9afc8c3ba24e94cbc7020889fe8ad7ef9.tar.gz
Support type modifiers for user-defined types, and pull most knowledge
about typmod representation for standard types out into type-specific typmod I/O functions. Teodor Sigaev, with some editorialization by Tom Lane.
Diffstat (limited to 'src/backend/nodes')
-rw-r--r--src/backend/nodes/copyfuncs.c5
-rw-r--r--src/backend/nodes/equalfuncs.c5
-rw-r--r--src/backend/nodes/makefuncs.c16
-rw-r--r--src/backend/nodes/outfuncs.c5
4 files changed, 15 insertions, 16 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index d46ed57d83..c8c9b907c9 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.357 2006/12/24 00:29:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.358 2006/12/30 21:21:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1584,7 +1584,8 @@ _copyTypeName(TypeName *from)
COPY_SCALAR_FIELD(timezone);
COPY_SCALAR_FIELD(setof);
COPY_SCALAR_FIELD(pct_type);
- COPY_SCALAR_FIELD(typmod);
+ COPY_NODE_FIELD(typmods);
+ COPY_SCALAR_FIELD(typemod);
COPY_NODE_FIELD(arrayBounds);
COPY_SCALAR_FIELD(location);
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 29bff448c7..57e61f0e2a 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.291 2006/12/24 00:29:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.292 2006/12/30 21:21:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1614,7 +1614,8 @@ _equalTypeName(TypeName *a, TypeName *b)
COMPARE_SCALAR_FIELD(timezone);
COMPARE_SCALAR_FIELD(setof);
COMPARE_SCALAR_FIELD(pct_type);
- COMPARE_SCALAR_FIELD(typmod);
+ COMPARE_NODE_FIELD(typmods);
+ COMPARE_SCALAR_FIELD(typemod);
COMPARE_NODE_FIELD(arrayBounds);
COMPARE_SCALAR_FIELD(location);
diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c
index 9f6aa22707..277103e4a1 100644
--- a/src/backend/nodes/makefuncs.c
+++ b/src/backend/nodes/makefuncs.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.52 2006/10/04 00:29:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/makefuncs.c,v 1.53 2006/12/30 21:21:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -262,12 +262,7 @@ makeRangeVar(char *schemaname, char *relname)
TypeName *
makeTypeName(char *typnam)
{
- TypeName *n = makeNode(TypeName);
-
- n->names = list_make1(makeString(typnam));
- n->typmod = -1;
- n->location = -1;
- return n;
+ return makeTypeNameFromNameList(list_make1(makeString(typnam)));
}
/*
@@ -282,14 +277,15 @@ makeTypeNameFromNameList(List *names)
TypeName *n = makeNode(TypeName);
n->names = names;
- n->typmod = -1;
+ n->typmods = NIL;
+ n->typemod = -1;
n->location = -1;
return n;
}
/*
* makeTypeNameFromOid -
- * build a TypeName node to represent a type already known by OID.
+ * build a TypeName node to represent a type already known by OID/typmod.
*/
TypeName *
makeTypeNameFromOid(Oid typeid, int32 typmod)
@@ -297,7 +293,7 @@ makeTypeNameFromOid(Oid typeid, int32 typmod)
TypeName *n = makeNode(TypeName);
n->typeid = typeid;
- n->typmod = typmod;
+ n->typemod = typmod;
n->location = -1;
return n;
}
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 4911d6ed40..2b21eae6a1 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.289 2006/12/24 00:29:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.290 2006/12/30 21:21:53 tgl Exp $
*
* NOTES
* Every node type that can appear in stored rules' parsetrees *must*
@@ -1476,7 +1476,8 @@ _outTypeName(StringInfo str, TypeName *node)
WRITE_BOOL_FIELD(timezone);
WRITE_BOOL_FIELD(setof);
WRITE_BOOL_FIELD(pct_type);
- WRITE_INT_FIELD(typmod);
+ WRITE_NODE_FIELD(typmods);
+ WRITE_INT_FIELD(typemod);
WRITE_NODE_FIELD(arrayBounds);
WRITE_INT_FIELD(location);
}