1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Fix up the remaining places where the expression node structure would lose

available information about the typmod of an expression; namely, Const,
ArrayRef, ArrayExpr, and EXPR and ARRAY SubLinks.  In the ArrayExpr and
SubLink cases it wasn't really the data structure's fault, but exprTypmod()
being lazy.  This seems like a good idea in view of the expected increase in
typmod usage from Teodor's work to allow user-defined types to have typmods.
In particular this responds to the concerns we had about eliminating the
special-purpose hack that exprTypmod() used to have for BPCHAR Consts.
We can now tell whether or not such a Const has been cast to a specific
length, and report or display properly if so.

initdb forced due to changes in stored rules.
This commit is contained in:
Tom Lane
2007-03-17 00:11:05 +00:00
parent 51d7741db1
commit 0f4ff460c4
21 changed files with 239 additions and 117 deletions

View File

@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.228 2007/02/27 23:48:09 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.229 2007/03/17 00:11:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1599,6 +1599,7 @@ scalararraysel(PlannerInfo *root,
args = list_make2(leftop,
makeConst(nominal_element_type,
-1,
elmlen,
elem_values[i],
elem_nulls[i],
@ -4717,7 +4718,8 @@ string_to_const(const char *str, Oid datatype)
{
Datum conval = string_to_datum(str, datatype);
return makeConst(datatype, ((datatype == NAMEOID) ? NAMEDATALEN : -1),
return makeConst(datatype, -1,
((datatype == NAMEOID) ? NAMEDATALEN : -1),
conval, false, false);
}
@ -4734,7 +4736,7 @@ string_to_bytea_const(const char *str, size_t str_len)
SET_VARSIZE(bstr, VARHDRSZ + str_len);
conval = PointerGetDatum(bstr);
return makeConst(BYTEAOID, -1, conval, false, false);
return makeConst(BYTEAOID, -1, -1, conval, false, false);
}
/*-------------------------------------------------------------------------