Package constants#8916
Conversation
…rong impure cache usage
|
Are comments supported for constants? I didn't see this in the documentation. Comments are simply supported for packaged procedures and functions. It would make sense to do the same for constants (and any package objects, for that matter). |
No, I didn't plan to implement comments, but I think it's possible. I will take a look |
|
@Noremos Please resolve the conflict. |
Done |
|
@asfernandes, thanks for the review. I'll resolve the issues tomorrow |
Co-authored-by: Adriano dos Santos Fernandes <529415+asfernandes@users.noreply.github.com>
|
@Noremos @asfernandes Do we have anything pending in this PR? |
I don't see any objections from @asfernandes to my fixes, so I think the pull request is ready to be accepted from my end. I can also provide the Firebird-QA tests that I used for testing. |
| // DefaultNode | ||
| // DerivedExprNode | ||
| // DomainValidationNode |
There was a problem hiding this comment.
I'm not sure these are correct as considering as constants if the children are.
IMO they should never be.
// DefaultNode
// DerivedExprNode
// DomainValidationNode
There was a problem hiding this comment.
DerivedExprNode is just a wrapper around expression, so IMO it's OK to detect its constness based on the children. From another side, it should never appear without a RSE it's embedded into, so maybe it's really a bad choice for a constant (IIRC, it may evaluate to NULL even if the underlying expression is constant).
There was a problem hiding this comment.
But it's always related to a table/context. Constants do not come from them.
There was a problem hiding this comment.
I removed it for now
|
I think the |
I add a list with all valid constant operations. |
Package Constants
This PR adds a new database object - Package Constant (#1036). It is a constant value located in a package header (public visibility) or a package body (private visibility). See README.packages.txt for more information.
SYNTAX
Creation:
<constant_expr>is an expression that remains unchanged after recompilation.Package constants can be queried using the expression
<package_name>.<consatnt_name>outside the package (<consatnt_name> must be a public constant) and using the expression<consatnt_name>inside the package.To query a constant, the user/role must have USAGE permission on the package.
Other SQL extensions:
Usage examples:
System Constants
As an exmaple, 3 consatnts have been added to the RDB$BLOB_UTIL package
System metadata changes
New system table - RDB$CONSTANTS
A new field has been added to
RDB$PACKAGES-RDB$PACKAGE_IDNew indexes:
Implementation
Packages have been added to the metacaching system. Since it relies heavily on identifiers, a new ID field (
RDB$PACKAGE_ID) has been added to theRDB$PACKAGEStable. Constants are stored as an array in the package metacaching object, with a constant_name-to-array_id mapping.There are also two important points: