Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upsert -- match null? #272

Open
davidAtInleague opened this issue Dec 23, 2021 · 0 comments
Open

upsert -- match null? #272

davidAtInleague opened this issue Dec 23, 2021 · 0 comments

Comments

@davidAtInleague
Copy link
Contributor

davidAtInleague commented Dec 23, 2021

hey upsert is great; I ran into the following using it, on the MSSQL grammar:

getInstance("queryBuilder@qb").from("rmme_foo").upsert(
	values = {a: 1, b: {value: "", null: true}, c: "some new string value"},
	target = ["a","b"],
	update = ["c"]
)

generates:

MERGE [rmme_foo] AS [qb_target] USING (VALUES (1, null, 'some new string value')) AS [qb_src] ([A], [B], [C]) ON
    [qb_target].[a] = [qb_src].[a] AND
    [qb_target].[b] = [qb_src].[b]  /* <------ this */
WHEN MATCHED THEN UPDATE SET [c] = [qb_src].[c]
WHEN NOT MATCHED BY TARGET THEN INSERT ([A], [B], [C]) VALUES ([A], [B], [C]);

the line marked <------- this should probably be [qb_target].[b] is null, otherwise it never matches (since null never equals null)

@elpete elpete transferred this issue from coldbox-modules/quick Dec 6, 2023
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

No branches or pull requests

1 participant