nopSolutions/nopCommerce · error · DataException
This database provider does not support backup
Error message
This database provider does not support backup
What it means
PostgreSqlDataProvider.BackupDatabaseAsync is an unimplemented stub that throws DataException. pg_dump-based backups are not exposed through the provider contract, so any backup call on PostgreSQL fails. Only MsSqlDataProvider implements a real backup.
Source
Thrown at src/Libraries/Nop.Data/DataProviders/PostgreSqlDataProvider.cs:263
{
var currentIdent = await GetTableIdentAsync<TEntity>();
if (!currentIdent.HasValue || ident <= currentIdent.Value)
return;
using var currentConnection = CreateDataConnection();
var seqName = GetSequenceName<TEntity>(currentConnection);
await currentConnection.ExecuteAsync($"select setval('{seqName}', {ident}, false);");
}
/// <summary>
/// Creates a backup of the database
/// </summary>
/// <returns>A task that represents the asynchronous operation</returns>
public virtual Task BackupDatabaseAsync(string fileName)
{
throw new DataException("This database provider does not support backup");
}
/// <summary>
/// Inserts record into table. Returns inserted entity with identity
/// </summary>
/// <param name="entity"></param>
/// <typeparam name="TEntity"></typeparam>
/// <returns>Inserted entity</returns>
public override TEntity InsertEntity<TEntity>(TEntity entity)
{
using var dataContext = CreateDataConnection();
try
{
entity.Id = dataContext.InsertWithInt32Identity(entity);
}
// Ignore when we try insert foreign entity via InsertWithInt32IdentityAsync method
catch (LinqToDBException ex) when (ex.Message.StartsWith("Identity field must be defined for"))
{View on GitHub (pinned to 64bdf2ff08)
Solutions
- Only call BackupDatabaseAsync for SQL Server; branch on DataProviderType.
- For PostgreSQL use pg_dump / pg_back / cloud snapshot tooling outside the app.
- Disable the backup UI for non-SQL-Server providers.
Example fix
// before
await dataProvider.BackupDatabaseAsync(path);
// after
if (DataSettings.DataProvider == DataProviderType.SqlServer)
await dataProvider.BackupDatabaseAsync(path);
else
throw new NotSupportedException($"Backup not supported for {DataSettings.DataProvider}; use pg_dump."); Defensive patterns
Strategy: validation
Validate before calling
if (DataSettings.DataProvider != DataProviderType.SqlServer)
throw new NotSupportedException("Backup via API is supported only for SQL Server.");
await dataProvider.BackupDatabaseAsync(path); Type guard
static bool SupportsApiBackup(DataProviderType t) => t == DataProviderType.SqlServer;
Try / catch
try { await dataProvider.BackupDatabaseAsync(path); }
catch (DataException ex) when (ex.Message.Contains("does not support backup"))
{ /* use pg_dump / cloud snapshot for PostgreSQL */ } Prevention
- Gate backup on provider type; only SQL Server via the API.
- Use pg_dump for PostgreSQL backups.
- Disable backup UI for PostgreSQL deployments.
When it happens
Trigger: Maintenance/admin code calls dataProvider.BackupDatabaseAsync(fileName) while DataSettings.DataProvider is PostgreSQL. The method body throws immediately; fileName is unused.
Common situations: Generic backup routine run against the INopDataProvider contract without checking provider type; admin 'Backup' button clicked on a PostgreSQL deployment; migrated from SQL Server without changing tooling.
Related errors
- This database provider does not support backup
- This database provider does not support database shrinking.
- Unable to connect to the new database. Please try one more t
- Data provider supports connection only with login and passwo
- Unable to connect to the new database. Please try one more t
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/214c83595dbcf374.
Report an issue: GitHub.