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 1tfjuX-004jaO-9X for pgsql-general@arkaria.postgresql.org; Wed, 05 Feb 2025 18:14:05 +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 1tfjuW-00Gukk-DW for pgsql-general@arkaria.postgresql.org; Wed, 05 Feb 2025 18:14:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tfjuW-00GukP-1x for pgsql-general@lists.postgresql.org; Wed, 05 Feb 2025 18:14:04 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tfjuT-003MFH-2w for pgsql-general@lists.postgresql.org; Wed, 05 Feb 2025 18:14:03 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-ab737e78900so21541166b.0 for ; Wed, 05 Feb 2025 10:14:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kleczek.org; s=google; t=1738779241; x=1739384041; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hbAq2K8MGD9oRWsQZr7pcvbPDMRkGw1W6wa2AEP/DVc=; b=EhW9PY3MrM7gjWK0e9yyMmyeJFWIHi/Po814v78Bjm2AYfKpeYM2rJzgmGT5DbVW+W 9uLwGJ5MZSgNJwpUMAXTUiC0xws64yJS5pMLMmP2lRl6T1UPZ4lv6ZTsH++SVxP18ADR Sj4XJeZ6FK4j5T2ib/O+h8kfbqlb1Dwqhmz4c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738779241; x=1739384041; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hbAq2K8MGD9oRWsQZr7pcvbPDMRkGw1W6wa2AEP/DVc=; b=YoDzGJOOnDFGuiqOfPzBr2ehqkx+UE5Lap2yNLwrEC/sOiYq/3DbxXRJ2uBSnuloI5 9/9U6HKP8aRZvAD8CPR5nB2qVrACpKMRM34NTYoqWWj1etJrmIxf92CfyPeJBe3c4322 hWKhtmcomrGMw31OTvn40Wnylo7/Ohu9ghm9HODdBSAmyP3AV3jXbjEuCsmtxMP1pHCb Jsiq2hIGrEIP+RaOm1XxTdAB3U/8EdxyDGRiT0A+pwRhpM9YLEEUGP9AIlz3+660AjMX EubInLaeGH3x+fvsMawaSBi9TPsPOes4wJQaqyd7iuYZyMb2wlHeiOAChg206Q8huZ+V m6tg== X-Gm-Message-State: AOJu0Yzjnum6wfyUIPiq/BRy0s4GmPiy+9JPlmVq798Pp2KejEKRkUmD m8TIWxfQ0WHEp5WTF4O/PNdJ7Tar/AutGjI8awdzQLNepz2HxWw9H/nq6+/hnjs= X-Gm-Gg: ASbGnctXKeN60LPcS3I3C7G4RQxMRceuzwKTjMgcQ6BrMctaOo0w/Ntf5yTrHGtG7Kh RHt5+fbnWBjoA6EQvcH0Vd/EKsVwpLuOkfpl2Vn81ifx4UvlEp4aMMiWN93ugDtpVtnk6WL688O b7oZC0Blq2QZTyTuwEiD19AxKuOGOexQEzHf3GP/G5fYCJMVAjwWMW+mIfr/xDltTLX+8rqLCt3 Ti4ZzAAN046VKP61v2FNxaa0naa/AplFsxOwPSo6rnJpyjp8z7ELPVNNJWWbbAwqW0eNJc5HvvY LbC9YxyygO05w56CyY9nEeI7l9icnJeXlLWxfFzNBvg= X-Google-Smtp-Source: AGHT+IEOupSPmqdXrwTCqoiVLi7cy53nGwKQIZ8itQho2Iml9VrvePy2iiT04zhUEJIWhmn1IEKDkA== X-Received: by 2002:a17:907:2d07:b0:ab6:c4e0:2d18 with SMTP id a640c23a62f3a-ab75e23e9f7mr444754166b.16.1738779240473; Wed, 05 Feb 2025 10:14:00 -0800 (PST) Received: from smtpclient.apple (b15.kleczek.org. [185.20.172.182]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a0000dsm1134099466b.89.2025.02.05.10.13.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Feb 2025 10:14:00 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.300.87.4.3\)) Subject: Re: Lookup tables From: =?utf-8?Q?Micha=C5=82_K=C5=82eczek?= In-Reply-To: Date: Wed, 5 Feb 2025 19:13:49 +0100 Cc: pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <4B983ADC-3A5C-442F-B377-D0C10FC1C100@kleczek.org> References: <6DCD3899-51A8-4032-A189-F2B51AD7CC8F@kleczek.org> To: Thiemo Kellner X-Mailer: Apple Mail (2.3826.300.87.4.3) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 5 Feb 2025, at 19:07, Thiemo Kellner = wrote: >=20 > El 04-02-25 a las 18:08, Micha=C5=82 K=C5=82eczek escribi=C3=B3: >>> Reality tends to become so ambiguous as to not be >>> reflectable (two entirely different restaurants eventually, >>> within the flow of time, carry the very same name). >>>=20 >>> A primary key is very likely not the proper place to reflect >>> arbitrary business logic (is it the same restaurant or not ? >>> what if two restaurants have the same name at the same time >> These are of course problems ( and beyond the scope of my contrived = example ). >>=20 >> The point is though, that having surrogate PK not only does not solve = these issues but makes them worse by kicking the can down the road and = allowing for inconsistencies. > Only if you do not see the primary key as the main immutable value = identifying an object, entity, you name it. Surrogate key cannot identify any (real) object by definition :) What object is identified by PK value 42 in =E2=80=9Crestaurants=E2=80=9D = table? > Having said that, it is very questionable that a natural key (names to = name one) can be a suitable primary key (think of typo). Typos are indeed a problem but adding surrogate key does not solve it, = I=E2=80=99m afraid. =E2=80=94 Michal=