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

Problem with a read-only marked database and Firebird 2.1 [CORE2026] #2463

Closed
firebird-automations opened this issue Aug 1, 2008 · 12 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: pesser (pesser)

Is related to QA240

My Software has an option to archive older data to an read-only marked database which may be stored to a CD or DVD. I created a Viewer program using IBObjects that displays the data. That worked very well up to Firebird 2.0.3.

Now I moved to Firebird 2.1.1. On opening a query with TIBOQuery (IBObjects) I get following error message:

attempted update on read-only database.

I debugged the source code of IBObjects and found out that following statement is used before opening the Query:

SELECT F.RDB$FIELD_NAME F_FieldName
, F.RDB$RELATION_NAME F_RelationName
, F.RDB$DEFAULT_SOURCE F_DefaultSource
, D.RDB$DEFAULT_SOURCE D_DefaultSource
, D.RDB$FIELD_TYPE D_FieldType
FROM RDB$RELATION_FIELDS F INNER JOIN RDB$FIELDS D
ON D.RDB$FIELD_NAME = F.RDB$FIELD_SOURCE
WHERE (( F.RDB$DEFAULT_SOURCE IS NOT NULL ) OR ( D.RDB$DEFAULT_SOURCE IS NOT NULL ))
AND NOT F.RDB$RELATION_NAME STARTING WITH 'RDB$'
ORDER BY 1

I tried some combinitians and found out that follwing statement fails with that error message:

select *
from rdb$relation_fields
where rdb$default_source is not null)

when I change this to:

select *
from rdb$relation_fields
where rdb$default_source <> null)

everything works well. (I didn't knew before that this is allowed...)

I think this is a bug of Firebird 2.1

Commits: d15b0f6 12745b5

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

I can't reproduce it.
Are you able to reproduce it with isql ?

@firebird-automations
Copy link
Collaborator Author

Commented by: pesser (pesser)

Hi Vlad,

thank you for your fast answer. Your right, the query works fine in iSQL. I made some more debugging in IBObjects and found out that the detching of a Dataset of table rdb$relation_fields with an filled rdb$default_source Blob seems to be the problem. The "workaround" with "<> null" doesn't work at all. This Query gives no datasets back and so there was no problem with fetching a dataset...

I could make a small sample application with IBObjects where the problem occurs or do you think I should ask Jason Wharton about this? As said before, with Firebird 2.0.3 and the same IBobjects-Version everything worked well...

Thanks Patrick

@firebird-automations
Copy link
Collaborator Author

Commented by: pesser (pesser)

Hi Vlad,

now I'm able to reproduce this in isql. Please follow the example:

isql
create table 'test.fdb' user 'sysdba' password 'masterkey' default character set ISO8859_1;
create table test (test integer default 0);
quit;

gfix test.fdb -mode read_only

isql
set names ISO8859_1;
connect 'test.fdb' user 'sysdba' password 'masterkey';
select * from rdb$relation_fields where rdb$default_source is not null;

<error>

The problem seems to be an read-only database with declared default values an using a character set at connection time.

I hope this helps.

Greetings Patrick

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Since FB 2.1 engine performs transliteraion of blobs between character sets. In this case system blob, stored in UNICODE_FSS, transliterated into connection charset. To do this, temporary blob is created. Engine didn't support temporary blobs creation in read-only databases since read-only databases was introduced in IB6.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

Version: 2.5 Alpha 1 [ 10224 ]

Version: 2.1.0 [ 10041 ]

Fix Version: 2.5 Beta 1 [ 10251 ]

Fix Version: 2.1.2 [ 10270 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

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

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

security: Developers [ 10012 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA240 [ QA240 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

QA test added.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: Done successfully

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