Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 77FFBF6B3CB for ; Thu, 19 Apr 2012 15:30:50 -0300 (ADT) Received: from mail-pb0-f46.google.com ([209.85.160.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SKw81-0005uz-BX for pgsql-sql@postgresql.org; Thu, 19 Apr 2012 18:30:50 +0000 Received: by pbcun15 with SMTP id un15so93757pbc.19 for ; Thu, 19 Apr 2012 11:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=wNdVzdvhPUcqcGbuIFPST17uaAWZnx/HcX0bonDSuiM=; b=02M5mB00M/DbPlRimmzfaZrIpJw9VhmsHv9GOqClK6bFs8XlG9vPDYImok8BVH7bVN GmISvR0HkdjUPdFBLrIzidoUbqcosEwHGZ0qEKB69AxBX720b2OVOnkw/YdEGUpSnXNC rHKT6cq6NZ+Po5aH9twoMLArXDESwZL7RW+wEnsotyH/BGzVyX6ESFkgY6O4tOS/Iq5M FXCOyBllyDERg8DB8HJIlLOrhi4BV+6qkWRVFsoX4G52MLVqPpRix+sV4HuxvE9ypKea 4U8AiqQleloff5zFzxAKKX8cYI9kBRKm1y+zxT/6GftzMCN6YLUWRKSCrCJUlCouxlJa Gsww== Received: by 10.68.224.228 with SMTP id rf4mr6391331pbc.22.1334860236599; Thu, 19 Apr 2012 11:30:36 -0700 (PDT) Received: from [172.16.1.88] ([208.187.158.94]) by mx.google.com with ESMTPS id a9sm2898691pbo.48.2012.04.19.11.30.34 (version=SSLv3 cipher=OTHER); Thu, 19 Apr 2012 11:30:35 -0700 (PDT) Message-ID: <4F905A2F.7080205@gmail.com> Date: Thu, 19 Apr 2012 12:32:15 -0600 From: Rob Sargent User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Uniform UPDATE queries References: <4F8E936A.9050303@victorem.com> <4420.1334766267@sss.pgh.pa.us> <4F8FEF2D.6050501@victorem.com> In-Reply-To: <4F8FEF2D.6050501@victorem.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201204/43 X-Sequence-Number: 36520 On 04/19/2012 04:55 AM, Dennis wrote: > Hello Tom, > > The example you have given is EXACTLY why something like CURRENT is > needed to limit the number of unique queries or prepared statements. (or > to do a selection of all values before an update meaning two executed > queries.) > > regards,. > > Dennis > > On 04/18/2012 06:24 PM, Tom Lane wrote: >> Dennis 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 =, z = z where ... >> >> There's no reason to invent nonstandard syntax for this. >> >> regards, tom lane >> >> >> > > Not if you have all the old and new values: update mytable set x= xval, y=yval, z=zval where yval happens to be a new value and xval, zval are current. Seems your callers knows which have changed. Does it not know which have not (and what their values are)?