mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 04:43:03 +01:00
Fixed CORE-5550 - Computed decimal field in a view has wrong RDB$FIELD_PRECISION.
This commit is contained in:
parent
eda12ed77a
commit
d334575818
@ -393,26 +393,8 @@ void defineComputed(DsqlCompilerScratch* dsqlScratch, RelationSourceNode* relati
|
||||
field->subType = desc.dsc_sub_type;
|
||||
}
|
||||
|
||||
if (field && field->precision == 0 && field->scale != 0)
|
||||
{
|
||||
switch (field->dtype)
|
||||
{
|
||||
case dtype_short:
|
||||
field->precision = 4;
|
||||
break;
|
||||
|
||||
case dtype_long:
|
||||
field->precision = 9;
|
||||
break;
|
||||
|
||||
case dtype_int64:
|
||||
field->precision = 18;
|
||||
break;
|
||||
|
||||
default:
|
||||
fb_assert(!DTYPE_IS_EXACT(field->dtype));
|
||||
}
|
||||
}
|
||||
if (field)
|
||||
field->setExactPrecision();
|
||||
|
||||
dsqlScratch->resetContextStack();
|
||||
|
||||
@ -8872,6 +8854,8 @@ void CreateAlterViewNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
|
||||
else
|
||||
newField.subType = desc.dsc_sub_type;
|
||||
|
||||
newField.setExactPrecision();
|
||||
|
||||
if (relField) // modifying a view
|
||||
{
|
||||
AutoRequest request2;
|
||||
|
@ -237,6 +237,31 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
void setExactPrecision()
|
||||
{
|
||||
if (precision != 0)
|
||||
return;
|
||||
|
||||
switch (dtype)
|
||||
{
|
||||
case dtype_short:
|
||||
precision = 4;
|
||||
break;
|
||||
|
||||
case dtype_long:
|
||||
precision = 9;
|
||||
break;
|
||||
|
||||
case dtype_int64:
|
||||
precision = 18;
|
||||
break;
|
||||
|
||||
default:
|
||||
fb_assert(!DTYPE_IS_EXACT(dtype));
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
USHORT dtype;
|
||||
FLD_LENGTH length;
|
||||
|
Loading…
Reference in New Issue
Block a user