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

CREATE TABLE with multiple COMPUTED columns results in invalid data stored in RDB$Computed_Source [CORE5357] #5630

Open
firebird-automations opened this issue Sep 24, 2016 · 4 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Sean Leyne (seanleyne)

Attachments:
Table_MultipleComputed.sql

If you execute the attached script and then run the following SQL,

SELECT RDB$FIELD\_NAME, RDB$COMPUTED\_SOURCE  
FROM RDB$FIELDS
WHERE RDB$COMPUTED\_SOURCE IS NOT NULL

you will see that the RDB$Computed_Source for the COMPUTED columns is completely invalid.

This is causing problems when trying to extract the schema metadata to script (or compare same with another database)

If you create the table without the COMPUTED columns and then add individually using ALTER TABLE statements, the RDB$Computed_Source is correct.

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

Attachment: Table_MultipleComputed.sql [ 13015 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

description: If you execute the attached script and then run the following SQL,

SELECT RDB$FIELD_NAME, RDB$COMPUTED_SOURCE
FROM RDB$FIELDS

you will see that the RDB$Computed_Source for the second COMPUTED column is invalid. This is causing problems when trying to extract the schema metadata to script (or compare same with another database)

=>

If you execute the attached script and then run the following SQL,

SELECT RDB$FIELD_NAME, RDB$COMPUTED_SOURCE
FROM RDB$FIELDS

you will see that the RDB$Computed_Source for the second COMPUTED column is invalid. This is causing problems when trying to extract the schema metadata to script (or compare same with another database)

If you create the table without the COMPUTED columns and then add individually using ALTER TABLE statements, the RDB$Computed_Source is correct.

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

description: If you execute the attached script and then run the following SQL,

SELECT RDB$FIELD_NAME, RDB$COMPUTED_SOURCE
FROM RDB$FIELDS

you will see that the RDB$Computed_Source for the second COMPUTED column is invalid. This is causing problems when trying to extract the schema metadata to script (or compare same with another database)

If you create the table without the COMPUTED columns and then add individually using ALTER TABLE statements, the RDB$Computed_Source is correct.

=>

If you execute the attached script and then run the following SQL,

SELECT RDB$FIELD\_NAME, RDB$COMPUTED\_SOURCE  
FROM RDB$FIELDS
WHERE RDB$COMPUTED\_SOURCE IS NOT NULL

you will see that the RDB$Computed_Source for the COMPUTED columns is completely invalid.

This is causing problems when trying to extract the schema metadata to script (or compare same with another database)

If you create the table without the COMPUTED columns and then add individually using ALTER TABLE statements, the RDB$Computed_Source is correct.

@firebird-automations
Copy link
Collaborator Author

Commented by: Arioch (arioch)

This also happens when you add multiple computed by columns by a single ALTER TABLE statement (DSQL syntax allows it, to save on table format modifications counter).

Just hit it when ironing out a legacy app with the following script.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

alter table T
add opener_connection integer,
add opener_netbios computed by ( left(C, nullif(position(':' in C),0)-1) ),
add opener_FB_user computed by ( substring(C from nullif(position(':' in C),0)+1) );

CREATE trigger T_biu_blocking_cxn for T
active before insert or update position 10
AS
begin
if (NEW.open_status = '1') then
begin
if (NEW.open_status is distinct from OLD.open_status) then
NEW.opener_connection = current_connection;
end else
NEW.opener_connection = NULL;
end;

~~~~~~~~~~~~~~~~~~

Affected versions: 2.1.7, 2.5.8

Tested on FB3rc2 - there this issue seems fixed.

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

No branches or pull requests

1 participant