Re: table alias for update

From: Bosco Rama <postgres(at)boscorama(dot)com>
To: hamann(dot)w(at)t-online(dot)de
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: table alias for update
Date: 2012-03-25 07:32:41
Message-ID: 4F6ECA19.8030201@boscorama.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hamann(dot)w(at)t-online(dot)de wrote:
>
> is there a way to use a table alias for the target table in an UPDATE query?
> I would like to avoid spelling out things like that in psql:
>
> update myverylongtablename set col1 = r.col1repl from repltable r
> where myverylongtablename.id = r.id and myverylongtablename.col2 > 0

update myverylongtablename as xyz
set col1 = ...
where xyz.id = ...;

The 'as' is optional ... though easier to read IMO.

HTH

Bosco.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2012-03-25 07:33:55 Re: Help in Parsing PG log usings CSV format
Previous Message hamann.w 2012-03-25 07:16:53 table alias for update