InsertResult return the same primary key
See original GitHub issueIssue type:
[ x] question [ x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[x ] sqlite
TypeORM version:
[x ] @next
@Entity()
export default class Marker extends BaseEntity {
@PrimaryGeneratedColumn() id = undefined
@Column('varchar') type = undefined
@Column('varchar', {
nullable: true
})
desc = undefined
@Column('double') long = undefined
@Column('double') lat = undefined
@Column('varchar', {
nullable: true
})
data = undefined
@CreateDateColumn() createTime = undefined
@UpdateDateColumn() updateTime = undefined
@ManyToOne(type => ProjectPanorama,{
onDelete: 'CASCADE'
})
projectPanorama
}
console.log(project.panoramas.find(projectP => projectP.id === p.id).markers)
const newMarkers = (await connection
.createQueryBuilder()
.insert()
.into(Marker)
.values(project.panoramas.find(projectP => projectP.id === p.id).markers)
.printSql()
.execute()).identifiers
console.log(newMarkers)
first log
[ {
type: 'jump',
desc: null,
long: 2,
lat: 1.5,
data: null,
createTime: '2018-05-13T08:41:04.000Z',
updateTime: '2018-05-13T08:41:04.000Z' },
{ desc: 'my desc', type: 'jump', long: 1, lat: 1 }
]
second log
[ { id: 92 }, { id: 92 } ]
Issue Analytics
- State:
- Created 5 years ago
- Reactions:20
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Returning ID of inserted query in TypeORM and MySQL
I,m new to TypeORM and I have problem that I'm trying to solve. I'm wondering how to retrieve ID after INSERT query. I...
Read more >InsertResult in sea_orm - Rust - Docs.rs
pub struct InsertResult<A>where ... The id performed when AUTOINCREMENT was performed on the PrimaryKey ... impl<T> Same<T> for T.
Read more >InsertResult | kysely
Class InsertResult. The result of an insert query. If the table has an auto incrementing primary key insertId will hold the generated id...
Read more >INSERT | CQL for Cassandra 3.x - DataStax Documentation
Inserts an entire row or upserts data into an existing row, using the full primary key. Requires a value for each component of...
Read more >upper/db - Go Packages
New(`upper: collection %q has no primary keys`) ErrWarnSlowQuery ... type InsertResult interface { // ID returns the ID of the newly ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I spent a lot of hours trying to find cause of my product’s much higher level bug, but the root of the problems, as it turned out, is this bug 😦
Same happens when using mysql databases. Would be cool if “identifiers” and “generatedMaps” contain the correct ids for all inserted objects.