aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/parse_coerce.c10
-rw-r--r--src/backend/parser/parse_node.c17
2 files changed, 16 insertions, 11 deletions
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 094e99a8acf..e46b63f6d9f 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.129 2005/05/29 18:24:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.130 2005/05/30 01:20:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -168,8 +168,11 @@ coerce_type(ParseState *pstate, Node *node,
if (!con->constisnull)
{
- char *val = DatumGetCString(DirectFunctionCall1(unknownout,
- con->constvalue));
+ /*
+ * We assume here that UNKNOWN's internal representation is the
+ * same as CSTRING
+ */
+ char *val = DatumGetCString(con->constvalue);
/*
* We pass typmod -1 to the input routine, primarily because
@@ -183,7 +186,6 @@ coerce_type(ParseState *pstate, Node *node,
* ugly...
*/
newcon->constvalue = stringTypeDatum(targetType, val, -1);
- pfree(val);
}
result = (Node *) newcon;
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c
index 921da9a04a5..20999f81ffe 100644
--- a/src/backend/parser/parse_node.c
+++ b/src/backend/parser/parse_node.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_node.c,v 1.88 2005/04/23 18:35:12 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_node.c,v 1.89 2005/05/30 01:20:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -271,8 +271,8 @@ transformArraySubscripts(ParseState *pstate,
* have to guess what type is wanted.
*
* For string literals we produce a constant of type UNKNOWN ---- whose
- * representation is the same as text, but it indicates to later type
- * resolution that we're not sure that it should be considered text.
+ * representation is the same as cstring, but it indicates to later type
+ * resolution that we're not sure yet what type it should be considered.
* Explicit "NULL" constants are also typed as UNKNOWN.
*
* For integers and floats we produce int4, int8, or numeric depending
@@ -341,11 +341,14 @@ make_const(Value *value)
break;
case T_String:
- val = DirectFunctionCall1(unknownin,
- CStringGetDatum(strVal(value)));
+ /*
+ * We assume here that UNKNOWN's internal representation is the
+ * same as CSTRING
+ */
+ val = CStringGetDatum(strVal(value));
typeid = UNKNOWNOID; /* will be coerced later */
- typelen = -1; /* variable len */
+ typelen = -2; /* cstring-style varwidth type */
typebyval = false;
break;
@@ -362,7 +365,7 @@ make_const(Value *value)
case T_Null:
/* return a null const */
con = makeConst(UNKNOWNOID,
- -1,
+ -2,
(Datum) 0,
true,
false);