You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure what pqNfields(res), pqntuples(res), or pqgetisnull(res, 0, 0) are but it seems like this check validates that a row was created in the db and raises an error if it wasn't. However, the row shouldn't be created, this is explicitly requested with ON CONFLICT DO NOTHING clause.
In the case of ON CONFLICT DO NOTHING the values are:
pqNfields(res) == 1
pqntuples(res) == 0
pqgetisnull(res, 0, 0) == 1
The text was updated successfully, but these errors were encountered:
moigagoo
changed the title
PostgrSQL: INSERT ... ON CONFLICT DO NOTHING raises DbError
PostgreSQL: INSERT ... ON CONFLICT DO NOTHING raises DbError
Nov 17, 2021
I'm implementing a way to ignore conflicts during insertion in Norm: moigagoo/norm#120
I've stumbled upon an issue with Postgres in ndb.
If you have an INSERT query with ON CONFLICT DO NOTHING, the query fails despite being a totally valid query with a totally normal result.
I think the root of the problem lays here: https://github.com/xzfc/ndb.nim/blob/master/ndb/postgres.nim#L705
I'm not sure what
pqNfields(res)
,pqntuples(res)
, orpqgetisnull(res, 0, 0)
are but it seems like this check validates that a row was created in the db and raises an error if it wasn't. However, the row shouldn't be created, this is explicitly requested withON CONFLICT DO NOTHING
clause.In the case of
ON CONFLICT DO NOTHING
the values are:The text was updated successfully, but these errors were encountered: