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 1tfMEl-001lRQ-EO for pgsql-general@arkaria.postgresql.org; Tue, 04 Feb 2025 16:57:23 +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 1tfMEk-005h8y-Im for pgsql-general@arkaria.postgresql.org; Tue, 04 Feb 2025 16:57:22 +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 1tfMEk-005h8p-81 for pgsql-general@lists.postgresql.org; Tue, 04 Feb 2025 16:57:22 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tfMEh-003Gdn-24 for pgsql-general@lists.postgresql.org; Tue, 04 Feb 2025 16:57:21 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-2164b662090so114254025ad.1 for ; Tue, 04 Feb 2025 08:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738688237; x=1739293037; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=cZpZqNbDijkh0yetXIomy5VdpeFT6ZIQdpajjHvBWug=; b=cT6WjCuYCQ+Pmbo1ByAfzneBfW0XKqDQhifIKkgwGM+eID3qJlkM/3yMTIltboppZF yeRCfFbVZCngyihTVdV9Cz9RJ6ej66J94uOuQ5Ch1nfi6E/EgJb3rYFOC7FPlMihkKl0 JieA+IIlhaFq8pZIXjp7vwIPDN/QBzquH6PVL6cDZBmu2B4pBk9v3ItfwoPH8WkPiQts r3V7ruhaDJzNA7de3jmaGNkq5mtPzinjgMVYQH/AYHptbl2KQF9I3EtDVHWBgoX1gQK2 jChzMaqwqAE9ClM9e5Pnx2pNIfJoayGYScICeWjF1RBeh6UJC094wYE2IYo5/4hjKslC PnjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738688237; x=1739293037; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cZpZqNbDijkh0yetXIomy5VdpeFT6ZIQdpajjHvBWug=; b=HjUbxdxOdpbAS23Bn5RtoIfZ0OMyE5n8BqzIuoDieBrieLYBeIgg3IkNvY2fRc1DHf YsHHN7tFUhgjnQZ72w+nnyZoOkZdNpIpE0uNEBA+W372tf4pr+etVWjOo3JkwMcIXPf4 X78NvEuHH6MOkhK5ypP/PCvb/vF3jUWSA3YA0T0GQWb7PTXQMOGHzd5AMmvIATZErhJ4 mzRgtDKmWiWCq3iUjIy5hc0ws/Gut+kn5nzNb/BnUUB/0/z1xNa7WkNmRdO2ukkiEXsr bedsQKuplB93eZGnsuSqnDdGQ1qF96gWepOyK+wIKLlcBDnu6Z9kisV7k9CQke1hWkxU 55oQ== X-Gm-Message-State: AOJu0YwnMSCceNJxolOj7vqT2XOhw5ees0LoFG2M49LXh1JYFKfxR4O0 DjPNVbr/VN3otlNWQOWI2u29xmAx0S4jw993+EJ4Us6g79MJcfwg/BTXJA== X-Gm-Gg: ASbGncsg+0VvuXMAMV38viMwd2bm8yo6c9zORbzcjqD7JFmWbPvKuQuHIsECkkNYZBq iulPMdUyjyL3vxjUZFNgml4AteG7BHtpbSYau/tM0nLQksF3NwtkpZ7VaG4EsaySOVmmoN5ANl4 v1+dxNgo+aRn9qkMUzGVwxtv0sZsTQfE0CPiI6vOTScNsrmYzQvYo6Eg8Ubrr8KjRZwMtuEv06T BxSmMwqvQNomhSThWmxh4f7x5OibBdtBKyEq9Vo6CZkqzLdLX7fKi0ZGb+BuNc8zWxs1lXI3utd QlwLJvj8bWnskp+fLZdg/5YszYrgmZejEUgxzEG7WICFUM/eB2w5izHOke0umWyIpg== X-Google-Smtp-Source: AGHT+IH3lF8lAfS0IVVjd/ZYVk4G+E+os9G9MaQEh1DKVZgYbpxY7UuUe6xGmV8t35/3oNG0Pu+VXQ== X-Received: by 2002:a17:903:948:b0:215:5c1a:f369 with SMTP id d9443c01a7336-21dd7c3c5d0mr431987195ad.11.1738688237368; Tue, 04 Feb 2025 08:57:17 -0800 (PST) Received: from ?IPV6:2601:681:4c01:7310:fdae:6140:a46c:4610? ([2601:681:4c01:7310:fdae:6140:a46c:4610]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21de32eb43asm98690365ad.156.2025.02.04.08.57.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Feb 2025 08:57:17 -0800 (PST) Message-ID: <6ebab108-715d-4fec-89fd-8fe309afe528@gmail.com> Date: Tue, 4 Feb 2025 09:57:16 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Lookup tables To: pgsql-general@lists.postgresql.org References: <4e7a338-c7d3-e944-20bd-a6e346e175c7@appl-ecosys.com> Content-Language: en-CA From: Rob Sargent In-Reply-To: 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 2/4/25 09:51, Karsten Hilbert wrote: > Am Tue, Feb 04, 2025 at 05:31:13PM +0100 schrieb Michał Kłeczek: > >> It is now completely unclear what it means to change the name of the restaurant for already registered visits. >> Is it still the same restaurant with a different name or a different restaurant? >> >> Or let say someone swaps names of two restaurants. >> That means a user that goes to the same restaurant every day would register visits to two different restaurants! >> >> Using the name of a restaurant as primary key gets rid of these logical anomalies because >> the database model now reflects facts from reality. > 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). > > 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 > ?). Primary keys are tools at the technical level. > > Karsten > -- > GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B > > That OP is using a single column is interesting:  Taking this notion to the restaurant/visit theme, the list of names or restaurants becomes a proper table 'restaurant' (name, addresss, phone, website, etc).  The name is as useless as a key as first/last is for person.