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

Support for partial indices #7257

Merged
merged 13 commits into from
Oct 19, 2022
Merged

Support for partial indices #7257

merged 13 commits into from
Oct 19, 2022

Conversation

dyemanov
Copy link
Member

As requested in #3750. Also supported by MS SQL, PostgreSQL, SQLite, MongoDB. Brief description can be found in Wikipedia.

@dyemanov dyemanov marked this pull request as ready for review August 12, 2022 13:35
@livius2
Copy link

livius2 commented Aug 12, 2022

Thank you for implementing this. Next step partial Foreign Key like in #7260

FOR (REQUEST_HANDLE tdgbl->handles_put_index_req_handle1)
X IN RDB$INDICES WITH
X.RDB$RELATION_NAME EQ relation->rel_name
if (tdgbl->runtimeODS >= DB_VERSION_DDL13_1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff comparation is not easy here.

Can't we use unique code where non-existent fields are read as NULL?

Or are you preventing problem of new gbak being connected to very old engine that treat non-existent fields as error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is to please old engine versions.

@@ -6616,6 +6649,40 @@ bool get_index(BurpGlobals* tdgbl, const burp_rel* relation)
general_on_error ();
END_ERROR;

if (hasConditionSrc || hasConditionBlr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Write to non-existent fields is possible since many versions ago.

@asfernandes
Copy link
Member

I suppose that if v4 opens an ODS 13.1 database with partial index, it may not work properly, trying to find entries in index without considering its condition, correct?

Do we consider these cases as valid for minor ODS upgrade?

@dyemanov
Copy link
Member Author

I suppose that if v4 opens an ODS 13.1 database with partial index, it may not work properly, trying to find entries in index without considering its condition, correct?

Do we consider these cases as valid for minor ODS upgrade?

v4 cannot attach an ODS 13.1 database.

@AppVeyorBot
Copy link

Build firebird 1.0.4757 completed (commit 91eb884b4f by @hvlad)

@dyemanov dyemanov self-assigned this Oct 18, 2022
@pavel-zotov
Copy link

Following script causes FB crash (checked on 5.0.0.938; problem in line marked as "[ ! ]"):

set bail on;
shell del c:\temp\tmp4test.fdb 2>nul;
create database 'localhost:c:\temp\tmp4test.fdb';
show version;
set list on;
set echo on;
recreate table test(
    id int primary key
    ,f01 int
    ,f02 int
);
create index test_f01 on test computed by (f01)
where f01 = 1 --------------------------------- [ ! ]
;

dyemanov added a commit that referenced this pull request Feb 17, 2023
… example in #7257). Better resource cleanup on error. Remove redundant ODS checks.
@dyemanov
Copy link
Member Author

@pavel-zotov Should be fixed now.

@pavel-zotov
Copy link

@@@ QA issue @@@
Currently this test contains only trivial cases for check.
More complex examples, including test of backup/restore, validation, using of misc datatypes (non-ascii, decfloat and int128), will be added later.

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

Successfully merging this pull request may close these issues.

7 participants