Skip to content

Failure with .annotate() and Concat() #12

Open
@dwasyl

Description

@dwasyl

Thanks for putting together this update.

I've run across a bug when I run the follow statement:
People.objects.annotate(full_name=Concat('last_name', Value(', '), 'first_name'), other_name=Concat('first_name', Value(' '), 'last_name'))

It generates a ProgrammingError:
ProgrammingError: ('42000', "[42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Column 'core_people.last_name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. (8120) (SQLExecDirectW); [42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Column 'core_people.first_name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. (8120);

This is running on SQL Server Express 2012.

Any ideas? The code runs fine on MySQL so it's not just a code issue.

Looking closer, this seems similar to michiya#94 and michiya#183. ichiya#94](michiya#94) points to a possible fix at azure-2.0...rnovacek:fix-concat-group-by-new

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