SHOW TABLE can issue inline comments after some (not all) fields

24 views
Skip to first unread message

Pavel Zotov

unread,
Oct 20, 2025, 9:22:33 AMOct 20
to firebird-devel
Consider following script:
=============
create domain dm_nil int;
create domain dm_not_null int not null;
create domain dm_nn_with_default int default 499 not null;

recreate table tbase(
   id smallint -- generated always as identity primary key using index tbase_pk -- not null implicit
  ,fn_both_nn_dm_nn dm_not_null             default 100 NOT NULL -- not null BOTH in field spec. and from domain
  ,fn_dm_nn dm_not_null                     default 200          -- not null from domain (implicit)
  ,fn_explicit_nn int                       default 300 NOT NULL -- not null explicit, type directly here (w/o domain)
  ,fn_dm_nil_explicit_nn            dm_nil  default 400 NOT NULL -- not null explicit, type from nullable domain
  ,fn_dm_nn_default_499 dm_nn_with_default               -- not null from domain (implicit), default = 499
  ,fn_dm_nn_default_500 dm_nn_with_default  default 500  -- not null from domain (implicit)
  ,fn_via_dm_nil dm_nil             -- nullable implicit, type from domain
  ,fn_explicit_nil int              -- nullable explicit, type directly here (w/o domain)
  ,id_quad computed by(id*id)
);

show table tbase;
=============

Its output will be:
=============
ID                              SMALLINT Nullable
FN_BOTH_NN_DM_NN                (DM_NOT_NULL) INTEGER Not Null default 100
FN_DM_NN                        (DM_NOT_NULL) INTEGER Not Null default 200          -- not null from domain (implicit)
FN_EXPLICIT_NN                  INTEGER Not Null default 300
FN_DM_NIL_EXPLICIT_NN           (DM_NIL) INTEGER Not Null default 400
FN_DM_NN_DEFAULT_499            (DM_NN_WITH_DEFAULT) INTEGER Not Null default 499
FN_DM_NN_DEFAULT_500            (DM_NN_WITH_DEFAULT) INTEGER Not Null default 500  -- not null from domain (implicit)
FN_VIA_DM_NIL                   (DM_NIL) INTEGER Nullable
FN_EXPLICIT_NIL                 INTEGER Nullable
ID_QUAD                         Computed by: (id*id)
=============
(checked on 3.x ... 6.x)

Is it expected that we can see comments for two columns here?

Denis Simonov

unread,
Oct 20, 2025, 9:46:34 AMOct 20
to firebird-devel
Comments are preserved in the default expression for the FN_DM_NN and FN_DM_NN_DEFAULT_500 fields.

DEFAULT <expression>

The <expression> itself is preserved as is until the next significant token.

понедельник, 20 октября 2025 г. в 16:22:33 UTC+3, Pavel Zotov:

Denis Simonov

unread,
Oct 20, 2025, 10:05:26 AMOct 20
to firebird-devel
I would prefer to be able to leave a persistent comment in place as described in https://github.com/FirebirdSQL/firebird/issues/8780


понедельник, 20 октября 2025 г. в 16:46:34 UTC+3, Denis Simonov:
Reply all
Reply to author
Forward
0 new messages