On 11-07-2026 23:47, Pavel Zotov wrote:
> On 4.x ... 6.x its output will be the same.
> Some data remain unclear for me:
> Q1. Value of RDB$FIELDS.RDB$FIELD_SUB_TYPE (in some rows, see them below
> marked as "????") - when it should be 1 or 0 ?
See comments inline below.
> Q2. Should the value of rdb$segment_lengthbe 'propagated'from blob to
> computed column that is based on this blob ?
Given segment lengths are just a holdover from the past, and should
never be relevant these days (except maybe in some ESQL cases?), I don't
think it's that important to change.
Also, computed columns where the expression is just another column
reference are rather artificial, which segment size should it choose if
there is a more complex expression, possibly involving multiple blob
columns with different segment sizes? If someone really still cares
about segment sizes, they should specify the data type, including
segment size, explicitly.
> ============
> TBIN BINARY(1) Nullable
> VBIN VARBINARY(1) Nullable
> BBIN BLOB segment 512, subtype BINARY Not Null
> COMP_TBIN Computed by: ( tbin )
> COMP_VBIN Computed by: ( vbin )
> COMP_BBIN Computed by: ( bbin )
> TCHR CHAR(1) Nullable
> VCHR VARCHAR(1) Nullable
> BCHR BLOB segment 2048, subtype TEXT
> CHARACTER SET WIN1250 Not Null
> COLLATE WIN_CZ
> COMP_TCHR Computed by: ( tchr )
> COMP_VCHR Computed by: ( vchr )
> COMP_BCHR Computed by: ( bchr )
>
> 14 - char
> 37 - varchar
> 261 - blob
>
> RF_FLD_NAME F_FIELD_TYPE F_FLD_SUB_TYPE F_SEGM_LEN|
> ============ ============ ============== ==========|
> TBIN 14 1 | [OK] // BINARY(1)
> ==> ~ "for the CHAR ... fixed binary data" ?
> VBIN 37 1 | ???? //
> VARBINARY(1) = varchar(1) char set octets
Why the ??? a VARBINARY is a VARCHAR with subtype 1, just like BINARY is
a CHAR with subtype 1.
> BBIN 261 0 512| [OK] // BLOB
> subtype BINARY ==> ~ "for the BLOB ... untyped (binary)"
> COMP_TBIN 14 0 | ???? // computed
> by: ( BINARY(1) )
> COMP_VBIN 37 0 | ???? // computed
> by: ( VARBINARY(1) )
Sounds like a bug in the type derivation, losing the subtype. This is
not unheard of, I think it also happens (or happened, I haven't checked
now) with computed columns involving NUMERIC and DECIMAL.
On the other hand, just like mentioned before, this is a rather
artificial case, having an expression that is just a column reference as
a computed column.
> COMP_BBIN 261 0 ? | seg? // computed by
> ( BLOB segment 512 subtype BINARY ) ==> ~ "for the BLOB ... untyped
> (binary)"
> TCHR 14 0 | ???? // CHAR(1)
> VCHR 37 0 | ???? // VARCHAR(1)
Why ??? for CHAR and VARCHAR, subtype 0 means its CHAR/VARCHAR, and not
BINARY/VARBINARY
> BCHR 261 1 2048| [OK] // BLOB ...
> subtype TEXT CHARACTER SET WIN1250
> COMP_TCHR 14 0 | ???? // computed by
> ( CHAR(1) )
> COMP_VCHR 37 0 | ???? // computed by
> ( VARCHAR(1) )
Again, why the ??? (though it could theoretically be losing the subtype
information, just like the earlier example).
> PS.
> The column RDB$FIELDS. RDB$FIELD_SUB_TYPE <https://
>
www.firebirdsql.org/file/documentation/html/en/refdocs/fblangref50/
> firebird-50-language-reference.html#fblangref-appx04-fields> is
> described in the doc as:
> =============
> Specifies the subtype for the BLOB data type:
> 0 - untyped (binary)
> 1 - text
> Specifies for the CHAR data type:
> 0 - *untyped* data
> 1 - fixed *binary* data
> =============
> What means " untyped" in the doc for Character type ?
Untyped means it's just a plain CHAR/VARCHAR and doesn't have a more
specific type like BINARY/VARBINARY. However, I'll see if I can rephrase
or clarify it.
The fact it says "CHAR data type" instead of "character data type" or
"CHAR/VARCHAR data type" is an error on my part. I guess when I started
writing it, I wanted to list CHAR and VARCHAR separately, and then
changed my mind. The word binary means it's binary data, not
specifically the BINARY datatype (typography matters here). That "fixed"
probably needs to go as well.
Mark
--
Mark Rotteveel