mirror of
https://github.com/postgres/postgres.git
synced 2025-11-16 15:02:33 +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:
@@ -10,7 +10,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.127 2007/02/22 22:00:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.128 2007/03/17 00:11:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -154,7 +154,8 @@ typedef struct Var
|
||||
typedef struct Const
|
||||
{
|
||||
Expr xpr;
|
||||
Oid consttype; /* PG_TYPE OID of the constant's datatype */
|
||||
Oid consttype; /* pg_type OID of the constant's datatype */
|
||||
int32 consttypmod; /* typmod value, if any */
|
||||
int constlen; /* typlen of the constant's datatype */
|
||||
Datum constvalue; /* the constant's value */
|
||||
bool constisnull; /* whether the constant is null (if true,
|
||||
@@ -236,17 +237,17 @@ typedef struct Aggref
|
||||
* reflowerindexpr must be the same length as refupperindexpr when it
|
||||
* is not NIL.
|
||||
*
|
||||
* Note: refrestype is NOT the element type, but the array type,
|
||||
* when doing subarray fetch or either type of store.
|
||||
* Note: the result datatype is the element type when fetching a single
|
||||
* element; but it is the array type when doing subarray fetch or either
|
||||
* type of store.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct ArrayRef
|
||||
{
|
||||
Expr xpr;
|
||||
Oid refrestype; /* type of the result of the ArrayRef
|
||||
* operation */
|
||||
Oid refarraytype; /* type of the array proper */
|
||||
Oid refelemtype; /* type of the array elements */
|
||||
int32 reftypmod; /* typmod of the array (and elements too) */
|
||||
List *refupperindexpr;/* expressions that evaluate to upper array
|
||||
* indexes */
|
||||
List *reflowerindexpr;/* expressions that evaluate to lower array
|
||||
|
||||
Reference in New Issue
Block a user