Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qJyGh-0002I7-7k for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jul 2023 15:30:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qJyGg-0000gU-5C for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jul 2023 15:30:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qJyGf-0000gK-Ge for pgsql-hackers@lists.postgresql.org; Thu, 13 Jul 2023 15:30:09 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qJyGb-000D4N-Dz for pgsql-hackers@lists.postgresql.org; Thu, 13 Jul 2023 15:30:08 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6686c74183cso889921b3a.1 for ; Thu, 13 Jul 2023 08:30:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20221208.gappssmtp.com; s=20221208; t=1689262205; x=1691854205; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=+BKsaIkZaKjRRZxLlwlGcNC/NpJig8TjRu2oqjNek+g=; b=3gCoKWVXG4jzx4Zc/T6EIK2R/UKDlSK8ESL+6mIRYSwErcL7KEIWkGRy75K9MayNDk L4OJ5VbOtd8JBf7cQ4hbj7mQD/yRVm0MRMP8x58++8CdEDZ5GiaZpNtLK4VvMQb6uceh 1dhMun1XAOQ9HQnkBVDtM0zjNBOWqnSeCe3N8ciEkJNrw2r844BsLInkdXEO81V/xlcb duuNayExwAk7EMPchArJwoVJmOEO2GWtuB/ObjFcV0z4VamVg5UAd9/FXmTTYiwHbyd7 oH2u8RmL9VBMHH3sWTn4VyC8Jxn8WPaHmlV7kgu93vAWKMepjkG/2FZ3rnj2Mxo/j10l XUeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689262205; x=1691854205; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+BKsaIkZaKjRRZxLlwlGcNC/NpJig8TjRu2oqjNek+g=; b=JKMETZJmxyrmED7cUXFDYxo99jaEZYUsDzrgXahOpwXSMJ9K4PWHwxvZfD9zwVfEEO nEXalsySqdcZW2CrS0l51CeW367TyqmXWhNYuM+m21WsQChNgSVYsLX31QYHw/icJCEd 2vj/PZIA4yKVpcZ5R4IVAQxMQcGjHO3JgP59s5hXDIVXEt1D2a/IbgDtws9feAFr1Fj5 G+uLw4uq7jSPRVu9RSYW4IhZjeZ09xUE+TKJUvz6OLUtuGe0qIc0cS4xbfKZlzwu671M mcohwvtgtJuPLMwadeug/8l6oG3w74QJzh6ApdvZ92AMJ0zvXYjqyta/V1xW6UCQL1Vl rUzQ== X-Gm-Message-State: ABy/qLYimCwsDwIIOAZhGKEMOh+mP4bPPbusOaSe0RLTG5cwVtSils6h Lw9jxDmQ5jGt4N5ZkCFoISPbMw== X-Google-Smtp-Source: APBJJlG8WsA4CKsWpEr0rFhgX0d9AKEV+fkvXfSyvTj0Jy+GTQKOwbnQ2WsjtJwdu3dmmPKKBeoFdA== X-Received: by 2002:a05:6a20:3d27:b0:12e:2fdb:7863 with SMTP id y39-20020a056a203d2700b0012e2fdb7863mr2207426pzi.21.1689262205382; Thu, 13 Jul 2023 08:30:05 -0700 (PDT) Received: from jeff-laptop.lan (c-73-170-46-202.hsd1.ca.comcast.net. [73.170.46.202]) by smtp.gmail.com with ESMTPSA id c2-20020aa78c02000000b00673e652985bsm5601158pfd.118.2023.07.13.08.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 08:30:04 -0700 (PDT) Message-ID: <5dde223210f37c68a81f8a91715e94526d99b443.camel@j-davis.com> Subject: Re: MERGE ... RETURNING From: Jeff Davis To: Dean Rasheed , PostgreSQL Hackers Date: Thu, 13 Jul 2023 08:30:03 -0700 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, 2023-01-08 at 12:28 +0000, Dean Rasheed wrote: > I considered allowing a separate RETURNING list at the end of each > action, but rapidly dismissed that idea. One potential benefit of that approach is that it would be more natural to specify output specific to the action, e.g.=20 WHEN MATCHED THEN UPDATE ... RETURNING 'UPDATE', ... which would be an alternative to the special function pg_merge_action() or "WITH WHEN". I agree that it can be awkward to specify multiple RETURNING clauses and get the columns to match up, but it's hard for me to say whether it's better or worse without knowing more about the use cases. Regards, Jeff Davis