diff --git a/pkg/ccl/backupccl/backup_planning.go b/pkg/ccl/backupccl/backup_planning.go index 8bf087d473e7..1d34bcb8ed06 100644 --- a/pkg/ccl/backupccl/backup_planning.go +++ b/pkg/ccl/backupccl/backup_planning.go @@ -701,6 +701,14 @@ func backupPlanHook( initialDetails.Destination.Subdir = latestFileName } else if subdir != "" { initialDetails.Destination.Subdir = "/" + strings.TrimPrefix(subdir, "/") + // Deprecation notice for `BACKUP INTO` syntax with an explicit subdir. + // Remove this once the syntax is deleted in 22.2. + p.BufferClientNotice(ctx, + pgnotice.Newf("BACKUP commands with an explicitly specified"+ + " subdirectory will be removed in a future release. Users can create a full backup via `BACKUP ... "+ + "INTO `, or an incremental backup on the latest full backup in their "+ + "collection via `BACKUP ... INTO LATEST IN `")) + } else { initialDetails.Destination.Subdir = endTime.GoTime().Format(DateBasedIntoFolderName) } diff --git a/pkg/ccl/backupccl/testdata/backup-restore/feature-flags b/pkg/ccl/backupccl/testdata/backup-restore/feature-flags index 98433489620e..c922280f2750 100644 --- a/pkg/ccl/backupccl/testdata/backup-restore/feature-flags +++ b/pkg/ccl/backupccl/testdata/backup-restore/feature-flags @@ -72,6 +72,11 @@ BACKUP TO 'nodelocal://1/deprecated/incfrom' INCREMENTAL FROM 'nodelocal://1/dep ---- NOTICE: The `BACKUP TO` syntax will be removed in a future release, please switch over to using `BACKUP INTO` to create a backup collection: https://www.cockroachlabs.com/docs/stable/backup.html#considerations. Backups created using the `BACKUP TO` syntax may not be restoreable in the next major version release. +exec-sql +BACKUP INTO 'deprecatedExplicitSubdir' IN 'nodelocal://1/deprecated'; +---- +NOTICE: BACKUP commands with an explicitly specified subdirectory will be removed in a future release. Users can create a full backup via `BACKUP ... INTO `, or an incremental backup on the latest full backup in their collection via `BACKUP ... INTO LATEST IN ` + exec-sql DROP TABLE d.t; ----