Araq / ormin

Ormin -- An ORM for Nim.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

returning id fail under postgresql

huaxk opened this issue · comments

commented
let id = query:
  insert antibot(id = ?expectedid, ip = "", answer = "just insert")
  returning id
stack trace: (most recent call last)
/home/huaxk/sources/ormin/ormin/queries.nim(941, 21) query
/home/huaxk/sources/ormin/ormin/queries.nim(845, 17) queryImpl
/home/huaxk/sources/ormin/tests/tforum.nim(67, 7) template/generic instantiation of `suite` from here
/home/huaxk/sources/ormin/tests/tforum.nim(419, 8) template/generic instantiation of `test` from here
/home/huaxk/sources/ormin/tests/tforum.nim(421, 14) template/generic instantiation of `query` from here
/home/huaxk/sources/ormin/ormin/queries.nim(845, 17) Error: cannot get child of node kind: nnkIdent

This error only under postgresql, no problem under sqlite.

model.sql as follow:

create table if not exists antibot(
  id integer primary key,
  ip varchar(20) not null,
  answer varchar(30) not null,
  created timestamp not null default CURRENT_TIMESTAMP
);

The code cause this error maybe queries.nim#733:
q.retType.add nimType
should be:
q.retType.add newIdentDefs(ident(colname), nimType)