"could not determine data type of parameter $1" in createQueryBuilder insert
See original GitHub issueIssue type:
[ ] question [x ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[x ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[ ] latest
[ ] @next
[x ] 0.2.8
(or put your version here)
I am trying to create an insertQuery with sql function in Nestjs framework like this :
const result = await this.userRepository
.createQueryBuilder()
.insert()
.into(User)
.values({
column_1: () => `nextval('table_id_seq')`,
column_2: user.column_2,
column_3: user.column_3,
column_4: user.column_4,
created_at: user.created_at,
})
.printSql()
.execute();
The error :
error: { error: could not determine data type of parameter $1
at Connection.parseE (C:\Users\trung\code\ims\exchange-nest\node_modules\pg\lib\connection.js:554:11)
at Connection.parseMessage (C:\Users\trung\code\ims\exchange-nest\node_modules\pg\lib\connection.js:379:19)
at Socket.<anonymous> (C:\Users\trung\code\ims\exchange-nest\node_modules\pg\lib\connection.js:119:22)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:601:20)
name: 'error',
length: 111,
severity: 'ERROR',
code: '42P18',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'postgres.c',
line: '1350',
routine: 'exec_parse_message' }
Is insertQuery not support param like column_1: () => nextval('table_id_seq')
, like updateQuery in #465
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Postgres Sql `could not determine data type of parameter` by ...
The PostgreSQL driver tries to figure out the type of the parameters to tell those parameters directly to the PostgreSQL Server.
Read more >getquill/quill - Gitter
@fwbrasil I am getting an error like "could not determine data type of parameter $1" based on a a query with a bunch...
Read more >Using Query Builder - MikroORM
or EntityRepository to have access to createQueryBuilder() method. ... const qb = em.createQueryBuilder(Author); qb.update({ name: 'test 123', type: PublisherType ...
Read more >TypeORM - Query Builder - Tutorialspoint
TypeORM - Query Builder, Query builder is used build complex SQL queries in an easy way. It is initialized from Connection method and...
Read more >Select using Query Builder - typeorm - GitBook
When using the QueryBuilder , you need to provide unique parameters in your WHERE ... There are two types of results you can...
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 Free
Top 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
@trunglh88 could you please reopen the issue? I just stumbled upon this and clearly that’s a bug. I want to use both
printSql
andvalues
. In myvalues
I simply pass an array of objects with simple values and not a single function.i remove .printSql() and query is execute success.