firebird icon indicating copy to clipboard operation
firebird copied to clipboard

Improvement: Allow inline comments for fields, procedure parameters, and more...

Open sim1984 opened this issue 2 months ago • 0 comments

MySQL allows you to leave comments in place for table fields, as well as procedure and function parameters.

For example, for a table, it looks like this:

CREATE TABLE IF NOT EXISTS `mwr_essence`
(
    `CODE_ESSENCE`  int         NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `CODE_GESSENCE` int         NOT NULL COMMENT 'Object type ID',
    `NAME`          varchar(50) NOT NULL COMMENT 'Security object name',
    PRIMARY KEY (`CODE_ESSENCE`),
    UNIQUE KEY `UNQ_ESSENCE` (`NAME`),
    KEY `FK_ESSENCE_GESSENCE` (`CODE_GESSENCE`)
) ENGINE = InnoDB
    COMMENT = 'Security objects'
  AUTO_INCREMENT = 1;

Example for a stored procedure and its parameters:

CREATE PROCEDURE SP_MW_GRANT_ROLE(
    IN A_MASTERROLE VARCHAR(50) COMMENT 'Master role name',
    IN A_DETAILROLE VARCHAR(50) COMMENT 'Detail role name',
    IN A_VALID INTEGER COMMENT 'If 1 then detail role is active, else is not active'
)
    SQL SECURITY INVOKER
    COMMENT 'Set role to another role'
BEGIN
/* ... */
END

Whereas in our case, descriptions of objects, table fields, and procedure parameters are created only separately using the COMMENT ON statement, which is usually located quite far from the column, parameter, or package procedure/function being described. It would be great to be able to leave in-place comments in Firebird as well. This would make metadata creation scripts clearer.

sim1984 avatar Oct 20 '25 14:10 sim1984