Re: Fwd: Problem with a "complex" upsert
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mario De Frutos Dieguez <mariodefrutos@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2018-06-21T17:05:53Z
Lists: pgsql-bugs
Attachments
- this-test-case-doesnt-fail.sql (text/plain)
Mario De Frutos Dieguez <mariodefrutos@gmail.com> writes: > I'm trying to do an upsert to an updatable view with the following SQL > query: > ... > If I don't get any conflict everything works as intended but if we hit a > conflict then I get the following error message: > ERROR: attribute 2 of type record has the wrong type > DETAIL: Table has type character varying, but query expects double > precision. When filing a bug report, it's a good idea to provide both a self- contained test case and a mention of what PG version you're using. I guess from the ROW() syntax you used here, which isn't accepted pre-v10, that you're using 10.0 or later, but that's not specific enough. I tried to duplicate this problem using the attached script, but it works for me. FWIW, that error message definitely looks like a bug, but I can't tell whether it's an already-fixed bug or there's some triggering detail you didn't mention. regards, tom lane
Commits
-
Fix INSERT ON CONFLICT UPDATE through a view that isn't just SELECT *.
- 5ad143cda092 9.5.14 landed
- f6a124d019a4 10.5 landed
- e7154b6acfeb 11.0 landed
- b8a1247a34e2 12.0 landed
- b484bffe7d0e 9.6.10 landed