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

Using system domain in procedures arguments/returns cause the proc to be unchangeable [CORE4018] #4349

Closed
firebird-issue-importer opened this issue Dec 28, 2012 · 10 comments

Comments

@firebird-issue-importer

Submitted by: rudi feijo (rudibr)

Is related to QA581

create a procedure using a system domain.

create or alter procedure CANT_DEL_OR_CHANGE
returns (info RDB$SOURCE)
as
begin
/* Procedure Text */
suspend;
end

the procedure becomes undeletable / unchangeable.
As you try to change or delete the proc, an exception is raised saying "domain cant be deleted, it contains n dependencies"

Commits: FirebirdSQL/fbt-repository@fc6cef3

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 31, 2012

Commented by: Sean Leyne (seanleyne)

A system domain should not be used by "user" structures, they are only intended for use for/by system structures. The definition of the domain could be changed in a later ODS update.

A comparable/synonym user domain should be created.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 21, 2013

Commented by: rudi feijo (rudibr)

Hello Sean,

I understand this is not a valid operation.

But what should be done if this happens to occur?

Sorry if this is the wrong channel to ask, but is there a workaround I could use to delete the procedure?

This error led one of our databases to become unusable. The procedure was created , cant be modifed or deleted, and is using characters not supported by the client's connection charset (which cannot be changed). This causes any connection to be refused by that client. (cannot transliterate).
Is there anyway to delete the procedure and avoid having to completely recreate the database?

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 21, 2013

Commented by: Sean Leyne (seanleyne)

1 - I might try to delete the appropriate entries from the RDB$ tables (after making a backup of the db ;-]), or
2 - see if other groups like IBSurgeon might be able to help, or
3 - use tool to extract schema to script, create new database without the offending SP and then use data pump tool to migrate the data

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 22, 2013

Commented by: rudi feijo (rudibr)

Thanks for the feedback.

I seem to have worked around it, even tough it seems like risky business, I will post it since I opened the ticket and I saw this same problem being posted a few years ago.

1. backed up db
2. created a user domain with the same definitions as the offending system domain (CREATE DOMAIN RDB_SOURCE AS BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET UNICODE_FSS)
3. updated all objects using the system domain to use the new user domain (update RDB$RELATION_FIELDS set RDB$FIELD_SOURCE = 'RDB_SOURCE' where RDB$FIELD_SOURCE = 'RDB$SOURCE')
4. deleted the procedure.
5. now the original system domain isnt being used anywhere else, it seems to have been auto-deleted, I guess its proposital behavior.
6. created a user domain with same definition and same name as the system domain (CREATE DOMAIN RDB$SOURCE AS BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET UNICODE_FSS)
7. updated all objects using the user domain to use the new user domain (update RDB$RELATION_FIELDS set RDB$FIELD_SOURCE = 'RDB$SOURCE' where RDB$FIELD_SOURCE = 'RDB_SOURCE')
8. deleted the temporary user domain RDB_SOURCE
9. updated RDB$FIELDS table to set the new user domain as a system domain (update RDB$FIELDS set RDB$SYSTEM_FLAG = 1 where RDB$FIELD_NAME = 'RDB$SOURCE')

Just for the record, I never have messed with system objects before, nor do I plan to in the future, or would advise anyone to do it too :p.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 22, 2013

Commented by: Sean Leyne (seanleyne)

Rudi,

Re #⁠5, I am not aware of any "auto-delete" feature for domain, so I am surprised that it "disappeared"

Does this mean that the case can be closed, or is there an issue which should still be address (i.e. should not be able to create user SPs which use system domains?)

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 23, 2013

Commented by: @asfernandes

The problem is not present in trunk. I believe it was fixed in the DDL refactor, but may be something else.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 23, 2013

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 29, 2014

Modified by: @pcisar

Link: This issue is related to QA581 [ QA581 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jul 12, 2015

Modified by: @pavel-zotov

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

QA Status: Done successfully

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jul 12, 2015

Modified by: @pavel-zotov

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

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

2 participants