typeorm-loader icon indicating copy to clipboard operation
typeorm-loader copied to clipboard

SQLITE_ERROR: ambiguous column name

Open peXed opened this issue 6 years ago • 0 comments

Hello!

I ran into an issue when using the loader with an TableInheritance base class.

It seems the loader loads the fields of the base-class multiple times when including more than one OneToMany relation.

I got one BaseEntity (entity and TableInheritance) like:

  • firstname
  • lastname
  • telephonenumbers (OneToMany)
  • emails (OneToMany)

It gets extended by an entity named Contact (child entity).

  • it adds some other fields, but they do not cause any error

If I now try to fetch a contact with telephonenumbers AND emails, it will throw the error, because it loads the baseentity.id twice.

SQLITE_ERROR: ambiguous column name: Q_BaseEntity.id

Querieng only one of the relations will work, because the BaseEntity id will only be loaded once.

peXed avatar Mar 25 '19 13:03 peXed