<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>It might have something to do with implicit transactional
      behaviour, ( START TRANSACTION;<i> commands</i>; COMMIT).</p>
    <p>Anyway, another little tidbit to remember  <br>
    </p>
    <pre class="moz-signature" cols="72">Med venlig hilsen / Kind regards

Bo Victor Thomsen</pre>
    <div class="moz-cite-prefix">Den 21-04-2022 kl. 17:32 skrev Paul
      Ramsey:<br>
    </div>
    <blockquote type="cite"
      cite="mid:3DA049FF-B46E-41E4-8553-13EC0DE7CD65@cleverelephant.ca">
      <pre class="moz-quote-pre" wrap="">Well now that you mention it, it does seem funky, and I have no idea what the expected behavour is...

create table foo (old text, new text);

insert into foo (old) values ('1234');

update foo set old = left(old, 2), new = old
where old = '1234';

select * from foo;

I'm going to go out on a limb and suggest that maybe the values on the right-hand side of the assignment are actually always implicitly from the original record, so in trigger terms, the assignments look like NEW.colname = OLD.colname.

P


</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">On Apr 21, 2022, at 2:12 AM, Bo Victor Thomsen <a class="moz-txt-link-rfc2396E" href="mailto:bo.victor.thomsen@gmail.com"><bo.victor.thomsen@gmail.com></a> wrote:

Am I the only one that get "semantic itch" looking at the UPDATE expression? I would prefer it like this:

UPDATE nyc_neighborhoods
  SET geom_invalid = geom,
      geom = ST_MakeValid(geom)
  WHERE NOT ST_IsValid(geom);
where you save the original "geom" value into another column "geom_invalid" before rectifying it and saving it into the original column.

Disclaimer: I have no clue about the internal methods of the SQL interpreter and how and in which order it assigns values.

Med venlig hilsen / Kind regards

Bo Victor Thomsen

Den 20-04-2022 kl. 16:59 skrev Regina Obe:
</pre>
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">Thanks for the errata.  Corrected now.
 
From: postgis-users [<a class="moz-txt-link-freetext" href="mailto:postgis-users-bounces@lists.osgeo.org">mailto:postgis-users-bounces@lists.osgeo.org</a>] On Behalf Of Jian He
Sent: Wednesday, April 20, 2022 5:12 AM
To: PostGIS Users Discussion <a class="moz-txt-link-rfc2396E" href="mailto:postgis-users@lists.osgeo.org"><postgis-users@lists.osgeo.org></a>
Subject: [postgis-users] PostGis introduction doc code block seems wrong....
 
 
23. Validity â€” Introduction to PostGIS
last code block, 
-- Fix invalid and save the original
UPDATE nyc_neighborhoods
  SET geom = ST_MakeValid(geom),
      invalid_geom = geom
  WHERE NOT ST_IsValid(geom);
 
I think it should be:
-- Fix invalid and save the original
UPDATE nyc_neighborhoods
  SET geom = ST_MakeValid(geom),
      geom_invalid = geom

  
WHERE NOT ST_IsValid(geom);
 


_______________________________________________
postgis-users mailing list

<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/postgis-users">https://lists.osgeo.org/mailman/listinfo/postgis-users</a>
</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/postgis-users">https://lists.osgeo.org/mailman/listinfo/postgis-users</a>
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/postgis-users">https://lists.osgeo.org/mailman/listinfo/postgis-users</a>
</pre>
    </blockquote>
  </body>
</html>