Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite88a7ad

Browse files
committed
Ooops, got only one of the two ArrayExpr variants correct in first
cut at exprTypmod support. Also, experimentation shows that we needto label the type of Const nodes that are numeric with a specifictypmod.
1 parent0f4ff46 commite88a7ad

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

‎src/backend/parser/parse_expr.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.213 2007/03/1700:11:04 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.214 2007/03/1701:15:55 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1958,7 +1958,7 @@ exprTypmod(Node *expr)
19581958
* typmod, else use -1
19591959
*/
19601960
ArrayExpr*arrayexpr= (ArrayExpr*)expr;
1961-
Oidarraytype=arrayexpr->array_typeid;
1961+
Oidcommontype;
19621962
int32typmod;
19631963
ListCell*elem;
19641964

@@ -1967,11 +1967,15 @@ exprTypmod(Node *expr)
19671967
typmod=exprTypmod((Node*)linitial(arrayexpr->elements));
19681968
if (typmod<0)
19691969
return-1;/* no point in trying harder */
1970+
if (arrayexpr->multidims)
1971+
commontype=arrayexpr->array_typeid;
1972+
else
1973+
commontype=arrayexpr->element_typeid;
19701974
foreach(elem,arrayexpr->elements)
19711975
{
19721976
Node*e= (Node*)lfirst(elem);
19731977

1974-
if (exprType(e)!=arraytype)
1978+
if (exprType(e)!=commontype)
19751979
return-1;
19761980
if (exprTypmod(e)!=typmod)
19771981
return-1;

‎src/backend/utils/adt/ruleutils.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.254 2007/03/1700:11:05 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.255 2007/03/1701:15:55 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -4427,8 +4427,11 @@ get_const_expr(Const *constval, deparse_context *context, bool showtype)
44274427
needlabel= false;
44284428
break;
44294429
caseNUMERICOID:
4430-
/* Float-looking constants will be typed as numeric */
4431-
needlabel= !isfloat;
4430+
/*
4431+
* Float-looking constants will be typed as numeric, but if
4432+
* there's a specific typmod we need to show it.
4433+
*/
4434+
needlabel= !isfloat|| (constval->consttypmod >=0);
44324435
break;
44334436
default:
44344437
needlabel= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp