Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Varchar computed column without explicit type does not populate RDB$CHARACTER_LENGTH [CORE5862] #6122

Closed
firebird-automations opened this issue Jun 27, 2018 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @mrotteveel

Duplicates CORE2228

When defining a computed column with an explicit type, the RDB$FIELDS.RDB$CHARACTER_LENGTH is populated. Doing the same without an explicit length leaves this column NULL.

Reproduction (using default character set UTF8):

CREATE TABLE TEST_COLUMN_METADATA (
col_varchar_default_user VARCHAR(100) DEFAULT USER,
col_varchar_default_literal VARCHAR(100) DEFAULT 'literal',
col_varchar_generated_explicit VARCHAR(201) COMPUTED BY (col_varchar_default_user || ' ' || col_varchar_default_literal),
col_varchar_generated_implicit COMPUTED BY (col_varchar_default_user || ' ' || col_varchar_default_literal)
)

col_varchar_generated_explicit will have

RDB$FIELDS.RDB$FIELD_LENGTH = 804
RDB$FIELDS.RDB$FIELD_TYPE = 37
RDB$CHARACTER_LENGTH = 201
RDB$CHARACTER_SET_ID = 4

col_varchar_generated_implicit however has:
RDB$FIELDS.RDB$FIELD_LENGTH = 804
RDB$FIELDS.RDB$FIELD_TYPE = 37
RDB$CHARACTER_LENGTH = NULL (0 in 2.5.8)
RDB$CHARACTER_SET_ID = 4

Based on the information available, Firebird should be able to populate RDB$CHARACTER_LENGTH with 201 for the implicit type as well.

Commits: 778542d 8a0ec26

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

description: When defining a computed column with an explicit type, the RDB$FIELDS.RDB$CHARACTER_LENGTH is populated. Doing the same without an explicit length leaves this column NULL.

Reproduction (using default character set UTF8):

CREATE TABLE TEST_COLUMN_METADATA (
col_varchar_default_user VARCHAR(100) DEFAULT USER,
col_varchar_default_literal VARCHAR(100) DEFAULT 'literal',
col_varchar_generated_explicit VARCHAR(201) COMPUTED BY (col_varchar_default_user || ' ' || col_varchar_default_literal),
col_varchar_generated_implicit COMPUTED BY (col_varchar_default_user || ' ' || col_varchar_default_literal)
)

col_varchar_generated_explicit will have

RDB$FIELDS.RDB$FIELD_LENGTH = 804
RDB$FIELDS.RDB$FIELD_TYPE = 37
RDB$CHARACTER_LENGTH = 201
RDB$CHARACTER_SET_ID = 4

col_varchar_generated_implicit however has:
RDB$FIELDS.RDB$FIELD_LENGTH = 804
RDB$FIELDS.RDB$FIELD_TYPE = 37
RDB$CHARACTER_LENGTH = NULL (0 in 2.5.8)
RDB$CHARACTER_SET_ID = 4

Based on the information available, Firebird should populated RDB$CHARACTER_LENGTH with 201 for the implicit type as well.

=>

When defining a computed column with an explicit type, the RDB$FIELDS.RDB$CHARACTER_LENGTH is populated. Doing the same without an explicit length leaves this column NULL.

Reproduction (using default character set UTF8):

CREATE TABLE TEST_COLUMN_METADATA (
col_varchar_default_user VARCHAR(100) DEFAULT USER,
col_varchar_default_literal VARCHAR(100) DEFAULT 'literal',
col_varchar_generated_explicit VARCHAR(201) COMPUTED BY (col_varchar_default_user || ' ' || col_varchar_default_literal),
col_varchar_generated_implicit COMPUTED BY (col_varchar_default_user || ' ' || col_varchar_default_literal)
)

col_varchar_generated_explicit will have

RDB$FIELDS.RDB$FIELD_LENGTH = 804
RDB$FIELDS.RDB$FIELD_TYPE = 37
RDB$CHARACTER_LENGTH = 201
RDB$CHARACTER_SET_ID = 4

col_varchar_generated_implicit however has:
RDB$FIELDS.RDB$FIELD_LENGTH = 804
RDB$FIELDS.RDB$FIELD_TYPE = 37
RDB$CHARACTER_LENGTH = NULL (0 in 2.5.8)
RDB$CHARACTER_SET_ID = 4

Based on the information available, Firebird should be able to populate RDB$CHARACTER_LENGTH with 201 for the implicit type as well.

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

Duplicates CORE2228, but it might be better to close that one in favor of this one given the explicit reproduction.

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

Link: This issue duplicates CORE2228 [ CORE2228 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Fix Version: 3.0.6 [ 10889 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment