Re Publish: Server`s EVENT NOTIFICATION dublicate error
- Dominant language
- C#
- Stars
- 460
- Forks
- 29
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 7
Description
- SqlPackage or DacFx Version: 162.0.52 (19.2)
- .NET Framework (Windows-only) or .NET Core: 4.8.04084
- Environment (local platform and source/target platforms):
- Windows 10 / Windows Server 2019 Datacenter 10.0 (Build 17763)
- VS 2019 (Version 16.11.21) / Microsoft SQL Server 2019 (RTM-CU19) (KB5023049) - 15.0.4298.1 (X64)
**Steps to Reproduce:**
1. Create new database project
2. Add EVENT NOTIFICATION ON Server (name not existed on tested server)
3. Build
4. Publish dacpac (on new database), as system admin
5. Repeat publish dacpac (the same database)
6. Get exception
**First Publish Log:**
```
Publishing to database 'Test' on server 'SQL'.
Initializing deployment (Start)
Initializing deployment (Complete)
Analyzing deployment plan (Start)
Analyzing deployment plan (Complete)
Updating database (Start)
Creating Test...
Creating [ENTest]...
Update complete.
Updating database (Complete)
Successfully published database.
```
**Second Publish Log:**
```
Publishing to database 'Test' on server 'SQL'.
Initializing deployment (Start)
Initializing deployment (Complete)
Analyzing deployment plan (Start)
Analyzing deployment plan (Complete)
Updating database (Start)
Creating [ENTest]...
An error occurred while the batch was being executed.
Updating database (Failed)
*** Could not deploy package.
Error SQL72014: .Net SqlClient Data Provider: Msg 2714, Level 16, State 21, Line 1 There is already an object named 'ENTest' in the database.
Error SQL72045: Script execution error. The executed script:
CREATE EVENT NOTIFICATION [ENTest]
ON SERVER
FOR DEADLOCK_GRAPH
TO SERVICE N'STest', N'current database';
```
**Did this occur in prior versions? If not - which version(s) did it work in?**
reproduced down to 17.4.1 (14.0.3917.1)
(DacFx/SqlPackage/SSMS/Azure Data Studio)
Contributor guide
Research direction
Start with the listed reproduction steps and compare the first and second publish logs, focusing on the generated CREATE EVENT NOTIFICATION script for [ENTest]. Reproduce with the stated DacFx and SQL Server versions, then verify that publishing the same dacpac twice completes without a duplicate-object error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100