<p dir="auto"><strong>Migrated issue, originally created by Michael Bayer (<a href="https://github.com/zzzeek">@zzzeek</a>)</strong></p>
<p dir="auto">apparently its all possible now.  might as well make a new syntax bonanza out of it:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="WITH upsert AS (
  UPDATE metric k SET k.count = k.count + 5
  WHERE event = &quot;foo&quot; AND interval = &quot;D&quot; and date = &quot;whatever&quot;
  RETURNING k.*
)
INSERT INTO metric (event, interval, date, count) 
SELECT (&quot;foo&quot;, &quot;D&quot;, &quot;whatever&quot;, 5)
WHERE NOT EXISTS (
  SELECT 1 FROM upsert
);"><pre class="notranslate"><code class="notranslate">WITH upsert AS (
  UPDATE metric k SET k.count = k.count + 5
  WHERE event = "foo" AND interval = "D" and date = "whatever"
  RETURNING k.*
)
INSERT INTO metric (event, interval, date, count) 
SELECT ("foo", "D", "whatever", 5)
WHERE NOT EXISTS (
  SELECT 1 FROM upsert
);
</code></pre></div>
<p dir="auto"><a href="http://www.postgresql.org/docs/9.1/static/sql-insert.html" rel="nofollow">http://www.postgresql.org/docs/9.1/static/sql-insert.html</a></p>
<hr>
<p dir="auto">Attachments: <a href="../wiki/imported_issue_attachments/2551/ticket_2551.patch">ticket_2551.patch</a> | <a href="../wiki/imported_issue_attachments/2551/CTE.sqlalchemy">CTE.sqlalchemy</a></p>
<p dir="auto"><strong>Migrated issue, originally created by Oleg Talalov (<a href="https://github.com/olegtalalov">@olegtalalov</a>)</strong></p>
<p dir="auto">Customer's database contains BINARY_FLOAT_INFINITY value in one column in few rows.</p>
<p dir="auto">During requsting rows in fetch, function _detect_decimal called with value '<del>' and raise exception:<br>
ValueError: invalid literal for int() with base 10: '</del>'</p>
<p dir="auto">I use cx_orcale 5.3 and 6.0</p>
<p dir="auto">Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production</p>