Re: Use ctid in where clause in update from statement

From: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Use ctid in where clause in update from statement
Date: 2019-07-01 09:50:22
Message-ID: a4e43abb-0130-4116-69b9-dde644315383@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/7/19 12:13 μ.μ., Dirk Mika wrote:
>
> *UPDATE*test_large d
>
> *SET* grp = s.grp
>
> *FROM* (*SELECT* ctid, test_large.*
>
> *FROM* test_large
>
> *WHERE* grp = 1) s
>
> *WHERE* d.ctid = s.ctid;
>

Besides, what the above does is select for rows that have grp=1 and then set grp to the same value.

> BR
>
> Dirk
>
> --
> Dirk Mika
> /Software Developer
>
> /
>
>
>
> mika:timing GmbH
> Strundepark - Kürtener Str. 11b
> 51465 Bergisch Gladbach
> Germany
>
> fon +49 2202 2401-1197
> dirk(dot)mika(at)mikatiming(dot)de
> www.mikatiming.de
>
> AG Köln HRB 47509 * WEEE-Reg.-Nr. DE 90029884
> Geschäftsführer: Harald Mika, Jörg Mika
>
>
>
>
> <https://youtu.be/qfOFXrpSKLQ>
>
>

--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dirk Mika 2019-07-01 10:02:21 Re: Use ctid in where clause in update from statement
Previous Message Daulat Ram 2019-07-01 09:42:28 RE: Memory settings