<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error when using SQL DELETE on archive view in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/error-when-using-sql-delete-on-archive-view/m-p/874567#M6451</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp;get the following error when I try to delete from an archive enabled feature class view (DELETE FROM myschema.mytable_evw WHERE objectid = 3;):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;ERROR:&amp;nbsp; date/time field value out of range: "12.31.9999 23:59:59.999"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;LINE 2: ...&amp;nbsp; WHERE objectid = old.objectid AND gdb_to_date = '12.31.999... &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;HINT:&amp;nbsp; Perhaps you need a different "datestyle" setting.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;QUERY:&amp;nbsp; UPDATE &lt;SPAN style="background-color: #f6f6f6;"&gt;myschema.&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;mytable&lt;/SPAN&gt; SET gdb_to_date&amp;nbsp; = current_timestamp(3) AT TIME ZONE 'UTC'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE objectid = old.objectid AND gdb_to_date = '12.31.9999 23:59:59.999'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;CONTEXT:&amp;nbsp; PL/pgSQL function &lt;SPAN style="background-color: #f6f6f6;"&gt;myschema&lt;/SPAN&gt;.nvv_update_11() line 15 at SQL statement&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;********** Error ********** &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;ERROR: date/time field value out of range: "12.31.9999 23:59:59.999"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;SQL state: 22008&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;Hint: Perhaps you need a different "datestyle" setting.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;Context: PL/pgSQL function &lt;SPAN style="background-color: #f6f6f6;"&gt;myschema&lt;/SPAN&gt;.nvv_update_11() line 15 at SQL statement&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #404040;"&gt;Updating and inserting records to the view works, but not deleting.&amp;nbsp;&lt;/SPAN&gt;Is this deliberate, and if so, why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #404040;"&gt;I'm using a 10.3.1 geodatabase in postgres&amp;nbsp;9.3.15 on linux.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #404040;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #404040;"&gt;Simon&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jan 2017 22:47:10 GMT</pubDate>
    <dc:creator>SiCasley</dc:creator>
    <dc:date>2017-01-03T22:47:10Z</dc:date>
    <item>
      <title>Error when using SQL DELETE on archive view</title>
      <link>https://community.esri.com/t5/geodatabase-questions/error-when-using-sql-delete-on-archive-view/m-p/874567#M6451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp;get the following error when I try to delete from an archive enabled feature class view (DELETE FROM myschema.mytable_evw WHERE objectid = 3;):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;ERROR:&amp;nbsp; date/time field value out of range: "12.31.9999 23:59:59.999"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;LINE 2: ...&amp;nbsp; WHERE objectid = old.objectid AND gdb_to_date = '12.31.999... &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;HINT:&amp;nbsp; Perhaps you need a different "datestyle" setting.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;QUERY:&amp;nbsp; UPDATE &lt;SPAN style="background-color: #f6f6f6;"&gt;myschema.&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;mytable&lt;/SPAN&gt; SET gdb_to_date&amp;nbsp; = current_timestamp(3) AT TIME ZONE 'UTC'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE objectid = old.objectid AND gdb_to_date = '12.31.9999 23:59:59.999'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;CONTEXT:&amp;nbsp; PL/pgSQL function &lt;SPAN style="background-color: #f6f6f6;"&gt;myschema&lt;/SPAN&gt;.nvv_update_11() line 15 at SQL statement&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;********** Error ********** &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;ERROR: date/time field value out of range: "12.31.9999 23:59:59.999"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;SQL state: 22008&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;Hint: Perhaps you need a different "datestyle" setting.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace; font-size: 15px;"&gt;Context: PL/pgSQL function &lt;SPAN style="background-color: #f6f6f6;"&gt;myschema&lt;/SPAN&gt;.nvv_update_11() line 15 at SQL statement&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #404040;"&gt;Updating and inserting records to the view works, but not deleting.&amp;nbsp;&lt;/SPAN&gt;Is this deliberate, and if so, why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #404040;"&gt;I'm using a 10.3.1 geodatabase in postgres&amp;nbsp;9.3.15 on linux.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #404040;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; color: #404040;"&gt;Simon&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jan 2017 22:47:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/error-when-using-sql-delete-on-archive-view/m-p/874567#M6451</guid>
      <dc:creator>SiCasley</dc:creator>
      <dc:date>2017-01-03T22:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using SQL DELETE on archive view</title>
      <link>https://community.esri.com/t5/geodatabase-questions/error-when-using-sql-delete-on-archive-view/m-p/874568#M6452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried setting the datestyle for for your transaction/session?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2017 15:50:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/error-when-using-sql-delete-on-archive-view/m-p/874568#M6452</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2017-01-04T15:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using SQL DELETE on archive view</title>
      <link>https://community.esri.com/t5/geodatabase-questions/error-when-using-sql-delete-on-archive-view/m-p/874569#M6453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestion Chris, but it doesn't seem to make a difference as the datestyle that causes the problem - &lt;SPAN style="background-color: #ffffff;"&gt;"12.31.9999 23:59:59.999" -&lt;/SPAN&gt;&amp;nbsp;is written in the trigger function created by SDE for an archive view. Seems odd that it should be written in this way when all other dates in the function are written as "9999-12-31 23:59:59".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2017 18:17:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/error-when-using-sql-delete-on-archive-view/m-p/874569#M6453</guid>
      <dc:creator>SiCasley</dc:creator>
      <dc:date>2017-01-04T18:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using SQL DELETE on archive view</title>
      <link>https://community.esri.com/t5/geodatabase-questions/error-when-using-sql-delete-on-archive-view/m-p/874570#M6454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I take it back - the datestyle setting was the issue &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&amp;nbsp;It needed to be set on the database (or in postgres.conf&lt;SPAN style="color: #242729; background-color: #eff0f1;"&gt;)&amp;nbsp;&lt;/SPAN&gt;to 'ISO MDY' &lt;EM&gt;before&lt;/EM&gt; enabling archiving on the feature class. If you make the change after the trigger function has already been created, the SQL DELETE returns successfully but the WHERE gdb_to_date = &lt;SPAN style="background-color: #ffffff;"&gt;"12.31.9999 23:59:59.999" clause still fails to delete the feature out of the base table.&lt;/SPAN&gt;&amp;nbsp;With the datestyle set to MDY before archiving, the trigger function changes slightly to use&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;"12.31.9999 23:59:59" (without the .999) and the SQL DELETE works.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2017 23:29:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/error-when-using-sql-delete-on-archive-view/m-p/874570#M6454</guid>
      <dc:creator>SiCasley</dc:creator>
      <dc:date>2017-01-05T23:29:43Z</dc:date>
    </item>
  </channel>
</rss>

