From 53de05b69bf55f5513ef3d3cc999570ed3ddca6a Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Mon, 11 Apr 2016 22:36:28 -0300 Subject: [PATCH 1/6] Fixed CORE-5194 - Invalid computed by definition generated by isql -x. --- src/dsql/DdlNodes.epp | 21 +++++++++++++++++++++ src/isql/isql.epp | 8 ++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/dsql/DdlNodes.epp b/src/dsql/DdlNodes.epp index 4030c88d0e..b5c24a6146 100644 --- a/src/dsql/DdlNodes.epp +++ b/src/dsql/DdlNodes.epp @@ -390,6 +390,27 @@ void defineComputed(DsqlCompilerScratch* dsqlScratch, RelationSourceNode* relati field->subType = desc.dsc_sub_type; } + if (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)); + } + } + dsqlScratch->resetContextStack(); // Generate the source text. diff --git a/src/isql/isql.epp b/src/isql/isql.epp index adaa9cd637..db1c26b4eb 100644 --- a/src/isql/isql.epp +++ b/src/isql/isql.epp @@ -1816,7 +1816,7 @@ bool ISQL_printNumericType(const char* fieldName, const int fieldType, const int // We are ODS >= 10 and could be any Dialect FOR FLD1 IN RDB$FIELDS WITH FLD1.RDB$FIELD_NAME EQ fieldName - AND FLD1.RDB$FIELD_PRECISION NOT MISSING + AND NOT FLD1.RDB$FIELD_PRECISION EQ 0 // We are Dialect >=3 since FIELD_PRECISION is non-NULL if (FLD1.RDB$FIELD_SUB_TYPE > 0 && FLD1.RDB$FIELD_SUB_TYPE <= MAX_INTSUBTYPES) @@ -1847,13 +1847,13 @@ bool ISQL_printNumericType(const char* fieldName, const int fieldType, const int case INTEGER: isqlGlob.printf("NUMERIC(9, %d)", -fieldScale); break; + case BIGINT: + isqlGlob.printf("NUMERIC(18, %d)", -fieldScale); + break; case DOUBLE_PRECISION: isqlGlob.printf("NUMERIC(15, %d)", -fieldScale); break; default: - // BIGINT can't happen there because it would have an explicit field_precision - // and then would be caught by the previous if(). - fb_assert(fieldType != BIGINT); isqlGlob.printf("%s", Column_types[i].type_name); } } From 85a25ee4e556ee747807ceffac3c3131a49cb503 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Tue, 12 Apr 2016 14:22:39 -0300 Subject: [PATCH 2/6] Warning. --- src/jrd/Optimizer.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/jrd/Optimizer.h b/src/jrd/Optimizer.h index fcf7d213de..93dfe728f0 100644 --- a/src/jrd/Optimizer.h +++ b/src/jrd/Optimizer.h @@ -263,6 +263,7 @@ public: return (baseSelectivity < MAXIMUM_SELECTIVITY); } + IndexedRelationships indexedRelationships; StreamType stream; bool baseUnique; double baseCost; @@ -270,8 +271,6 @@ public: int baseIndexes; bool baseNavigated; bool used; - - IndexedRelationships indexedRelationships; int previousExpectedStreams; }; From a61a1f50a7476ab7130fc0cd284df3a417013bba Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Tue, 12 Apr 2016 21:23:44 +0300 Subject: [PATCH 3/6] Fix the possible crash reported by Dimitry Sibiryakov in fb-devel. Maybe not the most efficient solution, but at least in sync with ~200 other places in the codebase. --- src/jrd/TempSpace.cpp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/jrd/TempSpace.cpp b/src/jrd/TempSpace.cpp index 1552a602ec..cc3f19aabd 100644 --- a/src/jrd/TempSpace.cpp +++ b/src/jrd/TempSpace.cpp @@ -30,17 +30,18 @@ #include "../jrd/err_proto.h" #include "../common/isc_proto.h" #include "../common/os/path_utils.h" +#include "../common/StatusArg.h" #include "../jrd/TempSpace.h" -using Firebird::TempFile; +using namespace Firebird; // Static definitions/initializations const size_t MIN_TEMP_BLOCK_SIZE = 64 * 1024; -Firebird::GlobalPtr TempSpace::initMutex; -Firebird::TempDirectoryList* TempSpace::tempDirs = NULL; +GlobalPtr TempSpace::initMutex; +TempDirectoryList* TempSpace::tempDirs = NULL; FB_SIZE_T TempSpace::minBlockSize = 0; offset_t TempSpace::globalCacheUsage = 0; @@ -98,7 +99,7 @@ FB_SIZE_T TempSpace::FileBlock::write(offset_t offset, const void* buffer, FB_SI // Constructor // -TempSpace::TempSpace(MemoryPool& p, const Firebird::PathName& prefix, bool dynamic) +TempSpace::TempSpace(MemoryPool& p, const PathName& prefix, bool dynamic) : pool(p), filePrefix(p, prefix), logicalSize(0), physicalSize(0), localCacheUsage(0), head(NULL), tail(NULL), tempFiles(p), @@ -107,11 +108,11 @@ TempSpace::TempSpace(MemoryPool& p, const Firebird::PathName& prefix, bool dynam { if (!tempDirs) { - Firebird::MutexLockGuard guard(initMutex, FB_FUNCTION); + MutexLockGuard guard(initMutex, FB_FUNCTION); if (!tempDirs) { MemoryPool& def_pool = *getDefaultMemoryPool(); - tempDirs = FB_NEW_POOL(def_pool) Firebird::TempDirectoryList(def_pool); + tempDirs = FB_NEW_POOL(def_pool) TempDirectoryList(def_pool); minBlockSize = Config::getTempBlockSize(); if (minBlockSize < MIN_TEMP_BLOCK_SIZE) @@ -284,7 +285,7 @@ void TempSpace::extend(FB_SIZE_T size) localCacheUsage += size; globalCacheUsage += size; } - catch (const Firebird::BadAlloc&) + catch (const BadAlloc&) { // not enough memory } @@ -371,18 +372,19 @@ TempSpace::Block* TempSpace::findBlock(offset_t& offset) const TempFile* TempSpace::setupFile(FB_SIZE_T size) { - Firebird::StaticStatusVector status_vector; + LocalStatus ls; + CheckStatusWrapper localStatus(&ls); for (FB_SIZE_T i = 0; i < tempDirs->getCount(); i++) { TempFile* file = NULL; - Firebird::PathName directory = (*tempDirs)[i]; + PathName directory = (*tempDirs)[i]; PathUtils::ensureSeparator(directory); for (FB_SIZE_T j = 0; j < tempFiles.getCount(); j++) { - Firebird::PathName dirname, filename; + PathName dirname, filename; PathUtils::splitLastComponent(dirname, filename, tempFiles[j]->getName()); PathUtils::ensureSeparator(dirname); if (!directory.compare(dirname)) @@ -402,9 +404,9 @@ TempFile* TempSpace::setupFile(FB_SIZE_T size) file->extend(size); } - catch (const Firebird::system_error& ex) + catch (const system_error& ex) { - ex.stuffException(status_vector); + ex.stuffException(&localStatus); continue; } @@ -412,10 +414,10 @@ TempFile* TempSpace::setupFile(FB_SIZE_T size) } // no room in all directories - Firebird::Arg::Gds status(isc_out_of_temp_space); - status.append(Firebird::Arg::StatusVector(status_vector.begin())); - iscLogStatus(NULL, status.value()); - status.raise(); + Arg::Gds status_vector(isc_out_of_temp_space); + status_vector.append(Arg::StatusVector(&localStatus)); + iscLogStatus(NULL, &localStatus); + status_vector.raise(); return NULL; // compiler silencer } @@ -480,7 +482,7 @@ void TempSpace::releaseSpace(offset_t position, FB_SIZE_T size) const offset_t end = position + size; fb_assert(end <= getSize()); // Block ends in file - if (freeSegments.locate(Firebird::locEqual, end)) + if (freeSegments.locate(locEqual, end)) { // The next segment is found to be adjacent Segment* const next_seg = &freeSegments.current(); @@ -502,7 +504,7 @@ void TempSpace::releaseSpace(offset_t position, FB_SIZE_T size) return; } - if (freeSegments.locate(Firebird::locLess, position)) + if (freeSegments.locate(locLess, position)) { // Check the prior segment for being adjacent Segment* const prior_seg = &freeSegments.current(); From 4a81181187529c80acfc437e0cfeb47ef55f24ce Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Tue, 12 Apr 2016 22:59:20 +0300 Subject: [PATCH 4/6] Minor cleanup for my last commit. --- src/jrd/TempSpace.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/jrd/TempSpace.cpp b/src/jrd/TempSpace.cpp index cc3f19aabd..896d430afd 100644 --- a/src/jrd/TempSpace.cpp +++ b/src/jrd/TempSpace.cpp @@ -30,7 +30,6 @@ #include "../jrd/err_proto.h" #include "../common/isc_proto.h" #include "../common/os/path_utils.h" -#include "../common/StatusArg.h" #include "../jrd/TempSpace.h" From 28176a6c8a91349a7178b4ccdd65cfe81cfdba6e Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Tue, 12 Apr 2016 23:01:09 +0300 Subject: [PATCH 5/6] Update the docs. --- doc/WhatsNew | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/WhatsNew b/doc/WhatsNew index aa67d4e764..7d416f7972 100644 --- a/doc/WhatsNew +++ b/doc/WhatsNew @@ -2,6 +2,11 @@ * v3.0 Final Release ************************** + * Bugfix CORE-5194 + Invalid COMPUTED BY definition generated by ISQL (extract metadata) + Contributor(s): + Adriano dos Santos Fernandes + * Bugfix CORE-5189 Codes of operation of user management plugin are missing in public API Contributor(s): From 2d838903e55341088419c086096f873e05b8f353 Mon Sep 17 00:00:00 2001 From: firebirds <> Date: Wed, 13 Apr 2016 00:02:46 +0000 Subject: [PATCH 6/6] increment build number --- src/jrd/build_no.h | 12 ++++++------ src/misc/writeBuildNum.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/jrd/build_no.h b/src/jrd/build_no.h index fe38a4724e..bd018b5b1d 100644 --- a/src/jrd/build_no.h +++ b/src/jrd/build_no.h @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:32474 + FORMAL BUILD NUMBER:32480 */ -#define PRODUCT_VER_STRING "3.0.0.32474" -#define FILE_VER_STRING "WI-V3.0.0.32474" -#define LICENSE_VER_STRING "WI-V3.0.0.32474" -#define FILE_VER_NUMBER 3, 0, 0, 32474 +#define PRODUCT_VER_STRING "3.0.0.32480" +#define FILE_VER_STRING "WI-V3.0.0.32480" +#define LICENSE_VER_STRING "WI-V3.0.0.32480" +#define FILE_VER_NUMBER 3, 0, 0, 32480 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "32474" +#define FB_BUILD_NO "32480" #define FB_BUILD_TYPE "V" #define FB_BUILD_SUFFIX "Firebird 3.0" diff --git a/src/misc/writeBuildNum.sh b/src/misc/writeBuildNum.sh index 0d7d1272fe..53f68aeaaf 100755 --- a/src/misc/writeBuildNum.sh +++ b/src/misc/writeBuildNum.sh @@ -9,7 +9,7 @@ BuildType=V MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=32474 +BuildNum=32480 NowAt=`pwd` cd `dirname $0`