4

I'm trying to create a query like:

INSERT INTO users (id, level)
VALUES (1, 0)
ON CONFLICT (id) DO UPDATE
SET level = users.level + 1;

However I can't see how to do this with opaleye? Is this not supported?

Strangely we have Insert defined with a field of iOnConflict :: Maybe OnConflict. However OnConflict is defined as: data OnConflict = DoNothing so it just looks like a placeholder for now?

Following through the issue listed on github, I see it leads to this eventual PR: https://github.com/tomjaguarpaw/haskell-opaleye/pull/385/files but I can't really make sense of it? I'm not sure if it's implementing just the placeholder, or it actually implements the functionality.

max taldykin
  • 12,459
  • 5
  • 45
  • 64
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286

1 Answers1

2

Firstly, you will generally get a quicker, and probably better, response to these kinds of questions if you file a new issue on the Opaleye repo.

Opaleye currently only supports ON CONFLICT DO NOTHING. I'm happy to look into supporting more functionality though. Please chime in with a new issue or on a relevant existing one.

Tom Ellis
  • 9,224
  • 1
  • 29
  • 54