Skip to content

Dev#788

Merged
erikdarlingdata merged 4 commits into
mainfrom
dev
May 12, 2026
Merged

Dev#788
erikdarlingdata merged 4 commits into
mainfrom
dev

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

No description provided.

erikdarlingdata and others added 4 commits May 12, 2026 04:16
…orted+exception (#784)

When @execution_type_desc = N'failed', the dynamic WHERE clause emits
qsrs.execution_type_desc IN (N'aborted', N'exception') instead of the
single-value parameter binding. Validation, RAISERROR text, and the
parameter docs (description / valid inputs) updated accordingly. The
three original values continue to use the existing parameterized = form.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The view-creation block stores each view's text as a binary literal in
#view_check.view_definition, then does a 3-way REPLACE to retarget it
to @output_database_name / @output_schema_name. The middle REPLACE was
searching for the bracketed form:

    N'[dbo]' + '.' + QUOTENAME(vc.view_name)

But the stored view definitions were rewritten to the unbracketed form
("CREATE VIEW dbo.HumanEvents_Blocking ...") back in October 2023 and
the REPLACE search pattern was never updated to match. So for any
@output_schema_name other than 'dbo', the schema swap silently no-op'd
and the resulting CREATE/ALTER VIEW statement still referenced 'dbo',
which doesn't exist in the user's output database — leading to:

    Msg 208, Level 16, State 6, Procedure HumanEvents_Blocking
    Invalid object name 'dbo.HumanEvents_Blocking'.

Fix is one line: search for "dbo." + view_name (unbracketed) to match
what's actually in the stored definitions. View bodies don't contain
"dbo.<view_name>" anywhere else, so there's no collision risk.

Fixes #785

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
) (#787)

The blocking-table INSERT's dynamic SQL had a leftover from the Sept
2024 "Cursor variables" refactor (9d3cff3) that switched column aliases
from "expr AS alias" to "alias = expr". One column kept both forms:

    sqlhandle =
        CONVERT
        (
            varbinary(64),
            bd.value(''(process/executionStack/frame/@sqLhandLe)[1]'', ...),
            1
        ) AS sqlhandle,

T-SQL rejects the combination — you get "Incorrect syntax near the
keyword 'AS'." on every blocking-table insert.

This was masked by #785's schema-replace bug: anyone using a non-dbo
@output_schema_name died at view creation before ever reaching the
blocking-table INSERT. With that fixed in #786, the reporter advanced
to this next error.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 182ddd9 into main May 12, 2026
9 checks passed
@erikdarlingdata erikdarlingdata mentioned this pull request May 13, 2026
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant