Re: Uniform UPDATE queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dennis <dennis(dot)verbeek(at)victorem(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Uniform UPDATE queries
Date: 2012-04-18 16:24:27
Message-ID: 4420.1334766267@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dennis <dennis(dot)verbeek(at)victorem(dot)com> writes:
> When a query is written to update a table, the usual process is to list all the columns that need
> updating. This could imply the creation of many possible queries for many columns. In an effort to
> keep the UPDATE queries more uniform, less number of unique queries, a keyword similar to DEFAULT,
> let's say CURRENT, is required to indicate that the current value must not change.

No it isn't. Just write the name of the column, eg

update mytable set x = x, y = <new value>, z = z where ...

There's no reason to invent nonstandard syntax for this.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message thomas veymont 2012-04-18 17:41:53 plpgsql : adding record variable to table
Previous Message Rob Sargent 2012-04-18 15:10:43 Re: Uniform UPDATE queries