With Update From ... vs. Update ... From (With)

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: With Update From ... vs. Update ... From (With)
Date: 2015-04-14 01:12:30
Message-ID: CAKFQuwZB32=5=W_y55B7oo1tA6JCZsv=Kd0Yo_V7q_HoPrX27w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello!

Is there any non-functional difference between these two forms of Update?

WITH name AS ( SELECT )
UPDATE tbl SET ...
FROM name
WHERE tbl.id = name.id

and

UPDATE tbl SET ...
FROM ( WITH qry AS ( SELECT ) SELECT * FROM qry ) AS name
WHERE tbl.id = name.id

They both better give the same results but does the backend treat them
differently?

Does the answer to my question depend on the version of PostgreSQL?

Thanks!

David J.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2015-04-14 01:46:05 Re: recovery of a windows archive in linux
Previous Message David G. Johnston 2015-04-14 01:03:17 Re: Help with slow table update