Skip to content

redb 4.8.0

Latest

Choose a tag to compare

@reliktbk reliktbk released this 01 Dec 21:25

Breaking

  • ISqlDialect.Query_WrapPvtWithObjectJson is replaced by Query_WrapPvtWithObjectRows. Only code that implements
    ISqlDialect itself is affected: the new member returns the _objects rows of the inner id list, in its order. A new
    member Query_WrapPvtWithIds returns the ids of that list alone, for the Free query delete. Packages: redb.Core. Upgrade: UPGRADING.md.
  • The packages target .NET 10 and .NET 11; .NET 8 and .NET 9 are no longer targets. Both reached end of support on
    10 November 2026. An application on .NET 8 or 9 stays on 4.7.x or moves to .NET 10. Packages: redb.Core, redb.Core.Pro, redb.Postgres, redb.Postgres.Pro, redb.MSSql, redb.MSSql.Pro, redb.SQLite, redb.SQLite.Pro, redb.Export. Upgrade: UPGRADING.md.
  • Tree providers take the save-interceptor pipeline. TreeProviderBase, ProTreeProviderBase and the six stock
    tree providers have a new last constructor argument, and RedbServiceBase.CreateTreeProvider a new parameter. Only
    code that subclasses a tree provider or overrides CreateTreeProvider is affected. Packages: redb.Core, redb.Core.Pro, redb.Postgres, redb.Postgres.Pro, redb.MSSql, redb.MSSql.Pro, redb.SQLite, redb.SQLite.Pro. Upgrade: UPGRADING.md.
  • WhereHasAncestor counts maxDepth up from the returned object, as WhereHasDescendant counts down. maxDepth: 1
    keeps the objects whose parent matches; it used to limit how deep below the start of the query the ancestor was looked
    for. Calls without maxDepth are unchanged; calls with it set the distance they want. Packages: redb.Core, redb.Core.Pro, redb.Postgres, redb.Postgres.Pro, redb.MSSql, redb.MSSql.Pro, redb.SQLite, redb.SQLite.Pro. Upgrade: UPGRADING.md.
  • One UserConfigurationService, in redb.Core. Its constructor takes the ISqlDialect of the provider, and the
    PostgreSQL and SQLite copies of the class are removed. Code that resolves IUserConfigurationService from DI changes
    nothing; code that constructs the class or names a provider copy follows the upgrade notes. Packages: redb.Core, redb.Postgres, redb.SQLite. Upgrade: UPGRADING.md.
  • IRedbQueryProvider.ExecuteDeleteAsync(long, string? filterJson) is removed. It threw NotSupportedException on
    every shipped provider. Delete through Query<T>().DeleteAsync() or pass a FilterExpression to the other overload. Packages: redb.Core. Upgrade: UPGRADING.md.
  • Legacy search, aggregate and window members of ISqlDialect are removed. They named functions no shipped database
    has and threw on every shipped dialect, or no provider called them; the base bodies of QueryProviderBase and
    TreeQueryProviderBase that called them are abstract or removed. Only code that implements a dialect or a provider is
    affected. Free on PostgreSQL and SQLite: ExecuteAggregateAsync with a JSON filter now runs instead of throwing. Packages: redb.Core, redb.Postgres, redb.MSSql, redb.SQLite. Upgrade: UPGRADING.md.
  • Custom dialects: Schemes_UpdateName is replaced by Schemes_Rename; Schemes_SelectRenamed and Structures_Rename
    are new.
    Only code that implements ISqlDialect is affected: add the three members and read _renamed_from in the
    scheme and structure selects, as the shipped dialects do. Packages: redb.Core. Upgrade: UPGRADING.md.
  • AddNewObjectsAsync no longer puts a nested new object under its referrer in the tree. It keeps the ParentId it carries, as SaveAsync does; before, every nested new object went under the first object given. Set ParentId yourself or use MoveObjectAsync where you want the tree child. Packages: redb.Core. Upgrade: UPGRADING.md.
  • Removing a field or changing a type now needs RedbScheme.Version. The sync deletes a structure with its values,
    or converts a type, only for a class whose Version is higher than the one the database recorded; without it the field
    stays and a warning is logged. A type changed without a raised version stops saves of that scheme
    (RedbPropertyTypeHeldException); it does not lose data. An older build next to a newer one changes nothing and its
    saves of that scheme are refused. DropUnknownStructuresAsync<TProps>() lists and deletes the fields a class no longer
    declares. Packages: redb.Core, redb.Postgres, redb.MSSql, redb.SQLite. Upgrade: UPGRADING.md.
  • Unused public members of the Pro SQL generators and the batch methods of the provider connections are no longer
    public.
    PvtSqlGenerator.GenerateExistsClause and GeneratePvtSelect (no query used them) are removed with the record
    CompiledPvtQuery and its namespace redb.Core.Pro.Query.Models. NpgsqlRedbConnection.ExecuteJsonBetweenAsync,
    NpgsqlRedbConnection.QueryThenAsync and SqlRedbConnection.QueryResultSetsAsync are now internal. Only code that
    calls these classes directly is affected. Packages: redb.Core.Pro, redb.Postgres.Pro, redb.MSSql.Pro, redb.SQLite.Pro, redb.Postgres, redb.MSSql. Upgrade: UPGRADING.md.
  • SQL Server: a save that names a missing object is refused, as on PostgreSQL. A reference to an object that does not
    exist, or a parent id that names no object, was stored and read back as null; the save now throws the foreign key error
    of the server. The database module goes to 0.2.41, and a role without schema rights no longer needs ALTER to save. Packages: redb.MSSql, redb.MSSql.Pro. Upgrade: UPGRADING.md.
  • Pro migrations: OnTypeChange<TFrom, TTo>().Using(...) is removed. A migration configured with it threw
    NotImplementedException when it ran. A type change of a property is converted by the scheme sync; a conversion of your
    own goes to Transform(...). Packages: redb.Postgres.Pro, redb.MSSql.Pro, redb.SQLite.Pro. Upgrade: UPGRADING.md.

Added

  • IRedbService.WithQueryPlanner(bool): the query planner option EnablePvtPrefilter for one block of code.
    using (redb.WithQueryPlanner(false)) { ... } runs the queries inside it with the query planner off (true: on);
    concurrent requests keep EnablePvtPrefilter, blocks nest. On Free, which has no planner, the block
    changes nothing; an own implementation of IRedbService gets that default. Packages: redb.Core, redb.Postgres.Pro, redb.MSSql.Pro, redb.SQLite.Pro.
  • A filter of redb Pro reads an element of an array or a list by its index. Where(e => e.SkillLevels![0] == 5) and
    Where(e => e.Contacts![0].Value == email) read the element itself or one field of an element of a class; an index past
    the end is a field without a value. These filters were refused before; the free providers still refuse them. Packages: redb.Core, redb.Core.Pro.
  • Index check and repair. IRedbService.CheckBaseIndexesAsync() and redb indexes check list every index of the base
    schema (and with Pro, of the modules in use) that the database lacks, has INVALID or has defined otherwise, with what it
    serves; RepairBaseIndexesAsync() and redb indexes repair build the missing ones online where the engine can. Packages: redb.Core, redb.Postgres, redb.MSSql, redb.SQLite, redb.CLI.
  • redb export and redb import carry the rename history of schemes and properties. An exported and re-imported
    database keeps the previous names that [RedbRename] and RedbScheme.RenamedFrom recorded, so a node with a class older
    than the rename still stops at its sync. A file written by an earlier version imports as before, with no history. Packages: redb.Export, redb.CLI.
  • [RedbRename("OldName")] renames a stored property in place. The scheme sync used to add the new name and, under
    the strict sync, delete the old one with its values. With the attribute, the stored property keeps its values; repeat
    it for a chain of renames. A node still running the class with the old name stops at its sync with
    RedbRenameConflictException instead of deleting the renamed property. The attribute stays on the property for good: its
    first name keeps the stored hashes valid. Upgrade: UPGRADING.md.
  • [RedbScheme(RenamedFrom = [...])] renames a stored scheme in place. A changed explicit name, or a renamed or moved
    class without one, used to get a new scheme and leave every object under the old one. List the previous names and the
    stored scheme is renamed, its objects stay; a node still running a class of the old name stops with
    RedbRenameConflictException. Upgrade: UPGRADING.md.

Changed

  • redb init on a SQLite file that already holds the redb schema upgrades it, as an application start does. On
    PostgreSQL and SQL Server it refuses such a database before it runs anything, as since redb.CLI 4.7.3; upgrade it with
    redb schema --upgrade, or drop and create it to start over. Packages: redb.CLI.
  • A filter path that is not a chain of fields of the queried object is refused with one NotSupportedException.
    ContainsKey or a dictionary indexer on something that is not a field, and a field reference the parser cannot read,
    threw ArgumentException with wordings of their own; an indexer on such a dictionary even reached the database with a
    made-up field name. They now throw NotSupportedException with the same message as the other path refusals. Packages: redb.Core, redb.Core.Pro.
  • DeleteSubtreeAsync runs the delete interceptors and clears the Props cache, as DeleteAsync does. One
    DeletingAsync before the delete (an exception stops it) and one DeletedAsync after, with the start object and every
    descendant in ObjectIds; every deleted object leaves the Props cache. Before, no interceptor saw a subtree delete. Packages: redb.Core.
  • An older package no longer puts its database module over a newer one. It starts with a warning when the newer module
    serves it and stops without changing anything when it does not, so nodes of two versions from 4.8.0 on may share one
    database during a rolling upgrade. The upgrade script run by hand refuses a newer module the same way before any change.
    The module goes to 0.7.26 (PostgreSQL), 0.2.45 (SQL Server), schema 13 (SQLite). Packages: redb.Core, redb.Postgres, redb.Postgres.Pro, redb.MSSql, redb.MSSql.Pro, redb.SQLite, redb.SQLite.Pro. Upgrade: UPGRADING.md.
  • Free: AnyAsync stops at the first match. A flat or tree query asks the database whether a matching object
    exists (EXISTS) instead of counting every match; the answer is the same. A query with Skip/Take still answers by
    the count of its page. Packages: redb.Core, redb.Postgres, redb.MSSql, redb.SQLite.
  • A ChangeTracking save draws keys only for the value rows it inserts. It used to draw one for every value row of
    the object and drop most of them, so the key sequence grew by the object's row count on every save. Value row ids
    are final in the Saved interceptor feed; nothing to do. Packages: redb.Core, redb.Core.Pro.
  • Fewer round trips for base-field projections and lookups by id. A Select that reads only base fields (id, name,
    dates, parent) no longer reads the scheme: it is one statement. On PostgreSQL Pro a query by object id no longer turns
    nested loops off while the tables have no planner statistics. See the README on statistics of a new database. Packages: redb.Core, redb.Postgres.Pro.
  • A property that changes between a single value, an array and a dictionary is no longer flipped over stored values.
    With values stored, the scheme sync stops with RedbCollectionKindChangeException naming the property and both kinds;
    before, the new class read the old rows wrong and the next save dropped them. A property without values changes as before. Packages: redb.Core. Upgrade: UPGRADING.md.
  • Pro: a stored dictionary key that no longer reads stops the load with RedbDictionaryKeyException. An enum key is
    stored by its member name; after a member is renamed or removed, loading an object with the old key now names the
    dictionary, the stored key and the key type, instead of a bare ArgumentException. No entry is skipped. Packages: redb.Core, redb.Core.Pro.
  • Start-up warns about missing base indexes. One Warning names every expected index the database lacks, has INVALID or
    has defined otherwise; nothing is built at start-up. CheckBaseIndexesOnStart = false turns it off. Packages: redb.Core. Upgrade: UPGRADING.md.
  • SQL Server: an OR of several Contains over one array reads its elements once. Skills.Contains("C#") || Skills.Contains("Python") becomes one check with the values in a list instead of one per value; the answers are the
    same. Packages: redb.MSSql.Pro.
  • PostgreSQL (Free): objects without a value for the sort key now come first when ascending and last when descending,
    as on Pro, SQL Server and SQLite and as LINQ orders null. They came last ascending, so pages sorted by such a field
    start with other objects now; the module goes to 0.7.28 at the next start. Packages: redb.Postgres. Upgrade: UPGRADING.md.
  • The duplicate index IX__values__array_parent_id is dropped. IX__values__array_parent_index serves the same lookups
    and the cascade of the parent key. The upgrade removes the duplicate only where that wider index exists, on PostgreSQL,
    SQL Server and SQLite; nothing to do, UPGRADING shows how to put it back. Packages: redb.Postgres, redb.MSSql, redb.SQLite. Upgrade: UPGRADING.md.
  • WhereHasAncestor(..., maxDepth: 1) on a tree query without a root now reads the children of the matching ancestors in one statement. Before, it collected them by one statement and sent their ids back to the server as an array parameter of the next. On 99 800 children of 20 ancestors a count went from 156 to 13 ms on PostgreSQL and from 746 to 58 ms on SQL Server; on 5 000 children from 15 to 3 ms and from 36 to 8 ms. On SQLite, TreeQuery(parents, maxDepth: 1) with several parents no longer reads every object of the scheme to find their children. Other depths and queries with a root keep the plans they have. Answers do not change. Packages: redb.Postgres.Pro, redb.MSSql.Pro, redb.SQLite.Pro.
  • PostgreSQL: a Contains over an array of simple values reads a rare value from its elements. When such a
    condition is the narrow one of a filter, the matching elements are read first, up to 5 000: fewer seed the query, more
    leave it as it was. A rare value no longer walks every object of the scheme; the answers are the same. Packages: redb.Postgres.Pro.
  • Pro: the indexes of the streams query form are built once, at the upgrade that brings them. Start-up no longer
    builds them again when they are missing; the index check reports them, and RepairBaseIndexesAsync() builds them. Packages: redb.Postgres.Pro, redb.MSSql.Pro. Upgrade: UPGRADING.md.
  • A window that reads no base field no longer joins _objects. Its rows come from the fields it reads, which already
    hold only the objects of the scheme; the statement of ToSqlStringAsync shows the shorter form. Results are the same. Packages: redb.Postgres.Pro, redb.MSSql.Pro, redb.SQLite.Pro.
  • SQLite: start-up keeps the planner statistics of the file. A file with no statistics and at least 10 000 value rows
    is analyzed once at start-up (a sampled ANALYZE, bounded by MaintenanceAnalysisLimit), and a file with statistics
    gets PRAGMA optimize. Without statistics SQLite could start a page from the whole scheme and take minutes on a large
    file. KeepSqlitePlannerStatistics = false turns it off. Packages: redb.SQLite, redb.Core.
  • SQLite: a Contains over an array of simple values reads a rare value from its elements. As on PostgreSQL, when
    such a condition is the narrow one of a filter, the matching elements are read first, up to 5 000: fewer seed the
    query, more leave it as it was; the answers are the same. Packages: redb.SQLite.Pro.
  • Microsoft dependencies move to the 10.0.15 servicing line. Microsoft.Extensions.*, Microsoft.Data.Sqlite, System.Security.Cryptography.Xml / Pkcs and the ASP.NET Core packages are referenced at 10.0.15 (was 10.0.13). An
    application that pins one of them lower raises its pin.

Deprecated

  • Object permissions and roles are deprecated and will be removed in a future major version. The permission and role
    methods, RoleProvider and the DefaultCheckPermissionsOn… settings are marked [Obsolete] (a warning); nothing
    changes in their behaviour in 4.x. Authorise in the application, as redb.Identity does, or use the database's own
    roles and row-level security. Users stay as the owner and the author of changes of objects. Packages: redb.Core.

Fixed

  • AddNewObjectsAsync no longer inserts a referenced object that is already saved a second time. Objects referring to an object saved before, by the same instance, failed with a duplicate key on _objects; the saved object is now written as a reference, as SaveAsync does, and is neither inserted nor changed. Packages: redb.Core.
  • A clash on the primary key of a redb table is no longer reported as a [RedbUnique] violation. On PostgreSQL and SQL Server, saving an object whose id is already taken threw RedbUniqueViolationException with the text of a unique key; the database's own primary-key error now comes through, as it already did on SQLite. Packages: redb.Core.
  • A new object referred to from a class that is a dictionary value is saved with its referrer. SaveAsync and AddNewObjectsAsync skipped it, and the save failed on a foreign key (SQL Server, SQLite) or stored a reference to an object that was never written. Packages: redb.Core.
  • SQLite Pro: a page sorted by a field and led by that field's values no longer starts from another filter. A filter
    such as Age >= 30 beside OrderByDescending(e => e.Salary).Take(100) could drive the statement from every matching
    object and probe the walked values for each; the walked values now always come first. Packages: redb.SQLite.Pro.
  • SQLite Pro: a page of a filter read from its matches no longer runs the filter once per object. On a database
    without planner statistics a page such as Where(e => e.Skills.Contains(x)).OrderByRedb(o => o.Id).Take(100) could
    run for minutes on a scheme of a hundred thousand objects; the page is now read once and its objects by key. Packages: redb.SQLite.Pro.

Earlier versions

Earlier releases are archived by line in changelog/: 4.7.x, 4.6.x, 4.5.x, 4.4.x, 4.3.x, 4.2.x, 4.1.x, 4.0.x, 3.x, 2.x, 1.x.