mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Fix transposed arguments for typmod for one INTERVAL production.
Mask both typmod subfields for INTERVAL to avoid setting the high bit, per dire warning from Tom Lane. Clear tmask for DTK_ISO_TIME case to avoid time zone troubles. Symptom reported by Tom Lane. Clean up checking for valid time zone info in output routine. This should now work for both SQL99 and Unix-style time zones. Put in explicit check for INTERVAL() typmod rounding to avoid accumulating cruft in the lower bits. Not sure that this helps, but we'll need to do something. The symptom is visible with a query like select interval(2) '10000 days 01:02:03.040506'; Regression tests are patched to repair the Tom Lane symptom, and all pass.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.264 2001/10/18 23:16:09 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.265 2001/10/20 01:02:14 thomas Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -887,13 +887,18 @@ zone_value: Sconst
|
||||
| ConstInterval Sconst opt_interval
|
||||
{
|
||||
A_Const *n = (A_Const *) makeStringConst($2, $1);
|
||||
n->typename->typmod = (($3 << 16) | 0xFFFF);
|
||||
if ($3 != -1)
|
||||
n->typename->typmod = (($3 << 16) | 0xFFFF);
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ConstInterval '(' Iconst ')' Sconst opt_interval
|
||||
{
|
||||
A_Const *n = (A_Const *) makeStringConst($5, $1);
|
||||
n->typename->typmod = (($3 << 16) | $6);
|
||||
if ($6 != -1)
|
||||
n->typename->typmod = (($6 << 16) | $3);
|
||||
else
|
||||
n->typename->typmod = ((0x7FFF << 16) | $3);
|
||||
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| FCONST
|
||||
@@ -4044,12 +4049,13 @@ SimpleTypename: ConstTypename
|
||||
| ConstInterval opt_interval
|
||||
{
|
||||
$$ = $1;
|
||||
$$->typmod = (($2 << 16) | 0xFFFF);
|
||||
if ($2 != -1)
|
||||
$$->typmod = ((($2 & 0x7FFF) << 16) | 0xFFFF);
|
||||
}
|
||||
| ConstInterval '(' Iconst ')' opt_interval
|
||||
{
|
||||
$$ = $1;
|
||||
$$->typmod = (($5 << 16) | $3);
|
||||
$$->typmod = ((($5 & 0x7FFF) << 16) | $3);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -5625,7 +5631,9 @@ AexprConst: Iconst
|
||||
n->typename = $1;
|
||||
n->val.type = T_String;
|
||||
n->val.val.str = $2;
|
||||
n->typename->typmod = (($3 << 16) | 0xFFFF);
|
||||
/* precision is not specified, but fields may be... */
|
||||
if ($3 != -1)
|
||||
n->typename->typmod = ((($3 & 0x7FFF) << 16) | 0xFFFF);
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ConstInterval '(' Iconst ')' Sconst opt_interval
|
||||
@@ -5634,7 +5642,9 @@ AexprConst: Iconst
|
||||
n->typename = $1;
|
||||
n->val.type = T_String;
|
||||
n->val.val.str = $5;
|
||||
n->typename->typmod = (($6 << 16) | $3);
|
||||
/* precision specified, and fields may be... */
|
||||
n->typename->typmod = ((($6 & 0x7FFF) << 16) | $3);
|
||||
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ParamNo
|
||||
|
Reference in New Issue
Block a user