Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qWMIb-0030Jo-9n for pgsql-general@arkaria.postgresql.org; Wed, 16 Aug 2023 19:35:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qWMIY-0095IP-UT for pgsql-general@arkaria.postgresql.org; Wed, 16 Aug 2023 19:35:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qWMIX-0095Ht-Ah for pgsql-general@lists.postgresql.org; Wed, 16 Aug 2023 19:35:18 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qWMIR-000WhV-MR for pgsql-general@lists.postgresql.org; Wed, 16 Aug 2023 19:35:16 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 48E005C03C1; Wed, 16 Aug 2023 15:35:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 16 Aug 2023 15:35:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1692214509; x=1692300909; bh=Uj2Ik7dvsOwk67g0WMtM+aoZqZUCw6wj+p+ inqo4uds=; b=LwSc8Bsz3OsDx6YLo9y7h2OefhmTQ6R3el1vKLoA31HCQbzxSI2 mPiTsKc+2vR3uP8VVsZeh0+iEI5sgOt+DM367c7sXcWKZlsW3GX5rZKUFvqIvprV kOvRJdJBJkaLoKjpUI8rsJHuGmIF9BW76kqkLHvS7OWFf9AM9ucTkXTGUCZAxIhv u6w4t3nmvdlNgSgteri6phMJNDGq6p2qjCYV8RA0Uz1h6/74FoCGzWe+e1Cr/LL0 mi8oe2svuBTz81k3ewzu1fJQzuzrNLYhU3CUIvZsCWdAr4OWaH2fgaD9XD62Sz7D xNJEzf3lEDi16jO0IPBWg3j5f69ASZaaMfg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1692214509; x= 1692300909; bh=Uj2Ik7dvsOwk67g0WMtM+aoZqZUCw6wj+p+inqo4uds=; b=p JwHUmcUjUjxuAGmdx/Ta9G179MxYS0wQM/91NesgqK39mB9HrNSs6KE+058xxw1N 9Go++SFaXILrdOZOyRYgY2lDL+3Y3O+lOSt9U2UbzKqSP1JagSrmQmwsfIM+3TgN 7MlCEfUyGqvmECxGG63v/+K7LE1GR9yOQ4QjgYvw/roVVF7d8iseruv9w2zn0Q7m MDjQedkH/HOl2Itx2sYw2koE+XJwUAHE4ZyXLxsTno8eiOFv2KI5JWShyroPJ05z 2AGlMi9onlNY6a7Rf7NpBKzhZr1007XyPlydORwwDD2RIJfXbZ7CdndViKXK10Gm kIp8oZ08Zchqhh2dwfFiw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddtledgudegudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepudfgueelgeevfffhgeeljeehhfettdegieelgefg heefffefveegjedtueetffdtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 16 Aug 2023 15:35:08 -0400 (EDT) Message-ID: <7de51aeb-600d-3375-ad65-6249f8e8f8a9@aklaver.com> Date: Wed, 16 Aug 2023 12:35:07 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: Converting sql anywhere to postgres To: Rob Sargent , pgsql-general@lists.postgresql.org References: <3fa3d5c7-67b5-444e-9bbd-4e1a8d7f549a@Spark> <94459638-f09a-64c5-49c5-9b8462b391ab@gmail.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: <94459638-f09a-64c5-49c5-9b8462b391ab@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/16/23 12:01, Rob Sargent wrote: > On 8/16/23 12:30, Guyren Howe wrote: >> For some reason, I was thinking the rule could see just the fields >> from the command, but you’re right; a rule won’t work. Sorry. >> >> Guyren G Howe >> On Aug 15, 2023 at 23:22 -0700, Russell Rose | Passfield Data Systems >> , wrote: >>> I have just had a quick look at rules and I am not sure how it can be >>> done. Rules still use the concept of NEW and OLD. If my original row >>> has 'myfield' set to 'me' then I don't think I can tell the >>> difference between: >>> >>> Update mytable set afield='something' >>> and >>> Update mytable set afield='something',myfield='me' >>> >>> Within the rule I think NEW.myfield will be set to 'me' in both >>> cases. Please can you explain how I can tell the difference between >>> the two update statements >>> > If the original value in the user column is "me", what is the difference > between "set other_column = some_value, user = 'me'" and "set > other_column = some_value" at the business level? Affirmation that the user updating the record explicitly set the user value. -- Adrian Klaver adrian.klaver@aklaver.com