8000 aggregate function throw error when column alias name is set · Issue #9927 · typeorm/typeorm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
aggregate function throw error when column alias name is set #9927
Closed
@shenX-2021

Description

@shenX-2021

Issue description

aggregate function throw error when column alias name is set

Expected Behavior

image

image

Actual Behavior

image

Steps to reproduce

import {
  BaseEntity,
  Column,
  Entity,
  createConnection, PrimaryGeneratedColumn
} from 'typeorm';


@Entity({ database: 'test', name: 'tb_serial_no' })
export class SerialNoEntity extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    type: 'int',
    name: 'serial_no_id',
    nullable: false,
    default: 0,
  })
  serialNoId: number;

}

async function boostrap() {
  const connection = await createConnection({
    type: "mariadb",
    host: "localhost",
    port: 3306,
    username: "root",
    password: "123123",
    database: "test",
    entities: [SerialNoEntity],
  });

  const count = await SerialNoEntity.maximum('serialNoId', {})
  console.log(count) // it should be printed
}

boostrap();

My Environment

Dependency Version
Operating System Mac Os
Node.js version 16.17.0
Typescript version 4.9.5
TypeORM version 0.3.12

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, and I know how to start.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0