From e392484582029d618b214d4de7e864f302171147 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Sun, 8 Dec 2024 09:17:45 -0300 Subject: [PATCH] Fixes to RDB$SQL package. --- doc/sql.extensions/README.sql_package.md | 10 +++++----- src/jrd/sys-packages/SqlPackage.cpp | 4 ++-- src/jrd/sys-packages/SqlPackage.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/sql.extensions/README.sql_package.md b/doc/sql.extensions/README.sql_package.md index b9a3dc6d95..676b000f0b 100644 --- a/doc/sql.extensions/README.sql_package.md +++ b/doc/sql.extensions/README.sql_package.md @@ -19,14 +19,14 @@ Output parameters: - `LEVEL` type `INTEGER NOT NULL` - indentation level (may have gaps in relation to parent's level) - `PACKAGE_NAME` type `RDB$PACKAGE_NAME` - package name of a stored procedure - `OBJECT_NAME` type `RDB$RELATION_NAME` - object (table, procedure) name -- `ALIAS` type `RDB$RELATION_NAME` - alias name +- `ALIAS` type `RDB$SHORT_DESCRIPTION` - alias name - `RECORD_LENGTH` type `INTEGER` - record length for the record source - `KEY_LENGTH` type `INTEGER` - key length for the record source -- `ACCESS_PATH` type `VARCHAR(255) CHARACTER SET UTF8 NOT NULL` - friendly plan description +- `ACCESS_PATH` type `RDB$DESCRIPTION NOT NULL` - friendly plan description ``` select * - from rdb$sql.explain('select * from employees where id = ?'); + from rdb$sql.explain('select * from employee where emp_no = ?'); ``` ``` @@ -34,9 +34,9 @@ select * from rdb$sql.explain(q'{ select * from ( - select name from employees + select full_name name from employee union all - select name from customers + select customer name from customer ) where name = ? }'); diff --git a/src/jrd/sys-packages/SqlPackage.cpp b/src/jrd/sys-packages/SqlPackage.cpp index 28ebf5268f..e6ba10635d 100644 --- a/src/jrd/sys-packages/SqlPackage.cpp +++ b/src/jrd/sys-packages/SqlPackage.cpp @@ -184,9 +184,9 @@ SqlPackage::SqlPackage(MemoryPool& pool) {"PARENT_RECORD_SOURCE_ID", fld_gen_val, true}, {"LEVEL", fld_integer, false}, {"OBJECT_TYPE", fld_obj_type, true}, - {"PACKAGE_NAME", fld_r_name, true}, + {"PACKAGE_NAME", fld_pkg_name, true}, {"OBJECT_NAME", fld_r_name, true}, - {"ALIAS", fld_r_name, true}, + {"ALIAS", fld_short_description, true}, {"CARDINALITY", fld_statistics, true}, {"RECORD_LENGTH", fld_integer, true}, {"KEY_LENGTH", fld_integer, true}, diff --git a/src/jrd/sys-packages/SqlPackage.h b/src/jrd/sys-packages/SqlPackage.h index 8ba2fda0ca..8ee8a685e8 100644 --- a/src/jrd/sys-packages/SqlPackage.h +++ b/src/jrd/sys-packages/SqlPackage.h @@ -52,7 +52,7 @@ private: (FB_SMALLINT, objectType) (FB_INTL_VARCHAR(METADATA_IDENTIFIER_CHAR_LEN * METADATA_BYTES_PER_CHAR, CS_METADATA), packageName) (FB_INTL_VARCHAR(METADATA_IDENTIFIER_CHAR_LEN * METADATA_BYTES_PER_CHAR, CS_METADATA), objectName) - (FB_INTL_VARCHAR(METADATA_IDENTIFIER_CHAR_LEN * METADATA_BYTES_PER_CHAR, CS_METADATA), alias) + (FB_INTL_VARCHAR(255 * METADATA_BYTES_PER_CHAR, CS_METADATA), alias) (FB_DOUBLE, cardinality) (FB_INTEGER, recordLength) (FB_INTEGER, keyLength)