1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

Fix exprTypmod to recognize length-coercion function expressions,

such as bpchar(char_expression, N), and pull out the attrtypmod that
the function is coercing to.  This allows correct deduction of the
column type in examples such as
CREATE VIEW v AS SELECT f1::char(8) FROM tbl;
Formerly we labeled v's column as char-of-unknown-length not char(8).
Also, this change causes the parser not to insert a redundant length
coercion function if the user has explicitly casted an INSERT or UPDATE
expression to the right length.
This commit is contained in:
Tom Lane
2000-02-26 21:11:10 +00:00
parent cbf4c9671e
commit 7173c485c8
2 changed files with 105 additions and 2 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: parse_expr.h,v 1.16 2000/01/26 05:58:27 momjian Exp $
* $Id: parse_expr.h,v 1.17 2000/02/26 21:11:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -23,5 +23,6 @@
extern Node *transformExpr(ParseState *pstate, Node *expr, int precedence);
extern Oid exprType(Node *expr);
extern int32 exprTypmod(Node *expr);
extern bool exprIsLengthCoercion(Node *expr, int32 *coercedTypmod);
#endif /* PARSE_EXPR_H */