<?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 PGSQL UPDATE - Error updating table entry: the content was changed before updation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758382#M239454</link>
    <description>&lt;P&gt;Here's my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib postgres
  preserve_col_names=no
  preserve_tab_names=no
  database=defaultdb
  server="db-postgresql-server"
  port=25060 user=doadmin
  password="pass"
  conopts="sslmode=require"
  DBCLIENT_MAX_BYTES=1
  dbmax_text=32767
  schema=myschema;

proc sql;
update mylib.mpe_users
  set last_seen_dt=%sysfunc(today())
  where user_id="allbow";
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And here is the response in the log:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;ERROR: Error updating table entry: the content was changed before updation&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Any clues?&amp;nbsp; Perhaps there is another libname option required..&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Further info:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;SYSVLONG=V.03.05M0P111119 SYSSCP=LIN X64&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Update - with SASTRACE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;95     proc sql;
96         update mylib.mpe_users
97           set last_seen_dt=%sysfunc(today())
98           where user_id="allbow";
WARNING: This SQL statement is not allowed to be passed directly to the DBMS for processing because the DBIDIRECTEXEC system option 
         is not turned on by the user or is temporarily turned off by Proc SQL.
POSTGRES: AUTOCOMMIT is NO for connection 1 0 1627651254 no_name 0 SQL     
POSTGRES: COMMIT performed on connection 1. 1 1627651254 no_name 0 SQL     
  2 1627651254 no_name 0 SQL     
POSTGRES_1: Prepared: on connection 1 3 1627651254 no_name 0 SQL     
SELECT * FROM "myschema".MPE_USERS 4 1627651254 no_name 0 SQL     
  5 1627651254 no_name 0 SQL     
  6 1627651254 no_name 0 SQL     
POSTGRES_2: Prepared: on connection 1 7 1627651254 no_name 0 SQL     
SELECT  "user_id", "last_seen_dt"  FROM "myschema".MPE_USERS  WHERE  ( "user_id" = 'allbow' ) 8 1627651254 no_name 0 SQL     
  9 1627651254 no_name 0 SQL     
  10 1627651254 no_name 0 SQL     
POSTGRES_3: Executed: on connection 1 11 1627651254 no_name 0 SQL     
Prepared statement POSTGRES_2 12 1627651254 no_name 0 SQL     
  13 1627651254 no_name 0 SQL     
POSTGRES: Called SQLSetPos(UPDATE)  14 1627651255 no_name 0 SQL     
POSTGRES: ROLLBACK performed on connection 1. 15 1627651255 no_name 0 SQL     
ERROR: Error updating table entry: the content was changed before updation&lt;/PRE&gt;</description>
    <pubDate>Fri, 30 Jul 2021 13:22:40 GMT</pubDate>
    <dc:creator>AllanBowe</dc:creator>
    <dc:date>2021-07-30T13:22:40Z</dc:date>
    <item>
      <title>PGSQL UPDATE - Error updating table entry: the content was changed before updation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758382#M239454</link>
      <description>&lt;P&gt;Here's my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib postgres
  preserve_col_names=no
  preserve_tab_names=no
  database=defaultdb
  server="db-postgresql-server"
  port=25060 user=doadmin
  password="pass"
  conopts="sslmode=require"
  DBCLIENT_MAX_BYTES=1
  dbmax_text=32767
  schema=myschema;

proc sql;
update mylib.mpe_users
  set last_seen_dt=%sysfunc(today())
  where user_id="allbow";
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And here is the response in the log:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;ERROR: Error updating table entry: the content was changed before updation&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Any clues?&amp;nbsp; Perhaps there is another libname option required..&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Further info:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;SYSVLONG=V.03.05M0P111119 SYSSCP=LIN X64&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Update - with SASTRACE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;95     proc sql;
96         update mylib.mpe_users
97           set last_seen_dt=%sysfunc(today())
98           where user_id="allbow";
WARNING: This SQL statement is not allowed to be passed directly to the DBMS for processing because the DBIDIRECTEXEC system option 
         is not turned on by the user or is temporarily turned off by Proc SQL.
POSTGRES: AUTOCOMMIT is NO for connection 1 0 1627651254 no_name 0 SQL     
POSTGRES: COMMIT performed on connection 1. 1 1627651254 no_name 0 SQL     
  2 1627651254 no_name 0 SQL     
POSTGRES_1: Prepared: on connection 1 3 1627651254 no_name 0 SQL     
SELECT * FROM "myschema".MPE_USERS 4 1627651254 no_name 0 SQL     
  5 1627651254 no_name 0 SQL     
  6 1627651254 no_name 0 SQL     
POSTGRES_2: Prepared: on connection 1 7 1627651254 no_name 0 SQL     
SELECT  "user_id", "last_seen_dt"  FROM "myschema".MPE_USERS  WHERE  ( "user_id" = 'allbow' ) 8 1627651254 no_name 0 SQL     
  9 1627651254 no_name 0 SQL     
  10 1627651254 no_name 0 SQL     
POSTGRES_3: Executed: on connection 1 11 1627651254 no_name 0 SQL     
Prepared statement POSTGRES_2 12 1627651254 no_name 0 SQL     
  13 1627651254 no_name 0 SQL     
POSTGRES: Called SQLSetPos(UPDATE)  14 1627651255 no_name 0 SQL     
POSTGRES: ROLLBACK performed on connection 1. 15 1627651255 no_name 0 SQL     
ERROR: Error updating table entry: the content was changed before updation&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jul 2021 13:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758382#M239454</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2021-07-30T13:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: PGSQL UPDATE - Error updating table entry: the content was changed before updation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758383#M239455</link>
      <description>&lt;P&gt;The clue was in the SASTRACE response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options DBIDIRECTEXEC;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;fixed it.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 13:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758383#M239455</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2021-07-30T13:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: PGSQL UPDATE - Error updating table entry: the content was changed before updation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758432#M239473</link>
      <description>&lt;P&gt;OK, so in order to update properly, the update really needed to be executed by the DBMS rather than SAS doing some kind of &lt;STRONG&gt;im&lt;/STRONG&gt;plicit pass through, is that correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And since&amp;nbsp;DBIDIRECTEXEC was not turned on, the update could not proceed.&amp;nbsp; The solution then was to turn on&amp;nbsp;DBIDIRECTEXEC, yes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OK, good to know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I too have found SASTRACE to be invaluable when working with external databases.&amp;nbsp; For what it's worth, I've found the below to be the most useful set of options for SASTRACE.&lt;/P&gt;
&lt;PRE&gt;OPTIONS 	SASTRACE		=	",,,ds";
OPTIONS 	SASTRACELOC		=	SASLOG;
OPTIONS 	NOSTSUFFIX;
&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 16:36:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758432#M239473</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-30T16:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: PGSQL UPDATE - Error updating table entry: the content was changed before updation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758482#M239485</link>
      <description>Yes, it seems that way!  Google didn't throw up much on this particular error..  Thanks for sharing your trace options!</description>
      <pubDate>Fri, 30 Jul 2021 19:02:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758482#M239485</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2021-07-30T19:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: PGSQL UPDATE - Error updating table entry: the content was changed before updation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758490#M239488</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28909"&gt;@AllanBowe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks for sharing your trace options!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You're welcome.&amp;nbsp; I hope they're helpful.&amp;nbsp; A lot of people just code ',,,d' (with out the s), but I like to see how many seconds the DBMS used.&amp;nbsp; The seconds can be helpful in understanding performance and in tuning queries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also&amp;nbsp;DEBUG=DBMS_SELECT can be helpful.&amp;nbsp; SASTRACE basically describes what the &lt;STRONG&gt;DBMS&lt;/STRONG&gt; is doing.&amp;nbsp;&amp;nbsp;DEBUG=DBMS_SELECT tells you a bit more information than normal about what &lt;STRONG&gt;SAS&lt;/STRONG&gt; is doing, primarily with&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;im&lt;/STRONG&gt;plicit&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;pass through queries.&amp;nbsp;&amp;nbsp;DEBUG=DBMS_SELECT isn't very helpful if all you're doing is&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;ex&lt;/STRONG&gt;plicit&lt;/EM&gt;&amp;nbsp;pass through queries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 19:33:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PGSQL-UPDATE-Error-updating-table-entry-the-content-was-changed/m-p/758490#M239488</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-30T19:33:22Z</dc:date>
    </item>
  </channel>
</rss>

