Skip to content

upsert -- match null? #272

Description

@davidAtInleague

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions