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 1v1A8A-005C29-Vo for pgsql-general@arkaria.postgresql.org; Tue, 23 Sep 2025 21:00:58 +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 1v1A89-0089Te-Mf for pgsql-general@arkaria.postgresql.org; Tue, 23 Sep 2025 21:00:57 +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 1v1A89-0089TW-Bp for pgsql-general@lists.postgresql.org; Tue, 23 Sep 2025 21:00:57 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v1A84-002V0p-0P for pgsql-general@lists.postgresql.org; Tue, 23 Sep 2025 21:00:57 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 88D221D00335; Tue, 23 Sep 2025 17:00:51 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 23 Sep 2025 17:00:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc: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:subject:subject:to:to; s=fm3; t=1758661251; x=1758747651; bh=tuBOooGu1tDK/H+V3rLCiOuud0myGyq+lEe5JLQ59jE=; b= vyxqJ6LRPNf/wlyaBw0PfXX4cKDYbchSHnq+MmChe5TxrGcLzDRxXvzt7rXaO3+b PoTSfM6rlkEWeC1H6Jcyd1SQAXRpS5pDWrDvUi1oVtyXV+bpVifa1QGuShjM4uXf Dfqd5vR39Pb5WF5+w40oGLzoYf3r4qLQ/Yfl7Bikm1RYC5RfRjp7c+opEZkXo6Jk g9fhjPJf8ZI7mHTlcoYissi4AhUAFFgZa9fJ4AD/5+xH/oDv11yszGOhFbrT1v+X qe7gQ8Qccu2akiY2ID0JfgUC61huOp7u51XVfzfM+NzpeNi5EpDr6sLyRmeAn2sT L1Nzld5vAOi0RHZLh3rHsQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1758661251; x= 1758747651; bh=tuBOooGu1tDK/H+V3rLCiOuud0myGyq+lEe5JLQ59jE=; b=k iH34ppdQs0gRXa43KYiyLILxn6Rr9V+AfQPYYzZVE4FMmUCmoXcIQQt+zHU1XSMB JAArEFr2SPyHvGyizbwflidgJrUno+M6Ex4xetkyPRkrwsCMl1598MGNmP2y2ucl IyHc4b9TBvRDwK0p82xhBAp9zrpAXghP3u69FAz2pXrSfl2EeVHsR9JCOg/feKr2 lk/rsDz/nZtuD+Ige42g1KU0BY8k18/7uUrCEunzBChNMA/EiSgHkksomP0kYBjV oCZKuvkpUZBCLHNSJyFeBhlyrfIdLqT8SU7vJhtDIpwwkiEBu1CBnEU6+Bd5E0mS NyAq6PNudKvgxF3LHFbEw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdeiudejhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomheptegurhhirghn ucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqe enucggtffrrghtthgvrhhnpeeuudefjeejgffgtddtgeehgfekueevkeekieettedtkeff heeivdethfevffegueenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghn rdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnhgspghrtghpthhtohepvddpmhhoug gvpehsmhhtphhouhhtpdhrtghpthhtohepshgrmhhuvghlmhgrrhhkshesghhmrghilhdr tghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsth hgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 23 Sep 2025 17:00:50 -0400 (EDT) Message-ID: Date: Tue, 23 Sep 2025 14:00:50 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: How do I upsert depending on a second table? To: Samuel Marks Cc: pgsql-general@lists.postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/23/25 13:56, Samuel Marks wrote: > the AS syntax can alternatively be used for aliases > https://www.postgresql.org/docs/current/sql-select.html > > `SELECT actual_tablename table0 WHERE table0.column00 = 1` Ok, I missed the: ... FROM org org_tbl ... > > (I used a space) Yeah, I use tbl_name AS alias_name to help these old eyes catch this sort of thing in my queries. -- Adrian Klaver adrian.klaver@aklaver.com