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 1tfMRG-001nA6-LF for pgsql-general@arkaria.postgresql.org; Tue, 04 Feb 2025 17:10:19 +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 1tfMRF-005vsh-Ox for pgsql-general@arkaria.postgresql.org; Tue, 04 Feb 2025 17:10:17 +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 1tfMRF-005vsK-Es for pgsql-general@lists.postgresql.org; Tue, 04 Feb 2025 17:10:17 +0000 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tfMRC-0039sI-2h for pgsql-general@lists.postgresql.org; Tue, 04 Feb 2025 17:10:16 +0000 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-2a0206590a7so3211078fac.0 for ; Tue, 04 Feb 2025 09:10:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738689014; x=1739293814; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=xmzhraRgY3zaWlcpx0Qf8YZOZER8wfqA3ogDUyFQ8kg=; b=ctPulqGHsvyWFdSjuKE2WgGsuw1RA1JHLf7h4x4Ef7TtfNH7cBGOKBa8IXLtl2rt+k gGUgbfpKj2cOQp6KAXHBR9y3dkZaiMJ/R9ug0GTudiD/gW4Ioo+phCt+hHmJc6emOxb9 4wILzDv++6rG/s6oGxOSzLefTz0cU9QgzMMkRi+AcKnSbnjsGSjA3q54Ootnwdz45etu jPg7dX6A5SbL0GJDLycq5SPjX1TBhdfKaxt+4IaW3h1Ym6ERVo04U4IC5Iek278FpbLh ILNbs4OrlMtOueCIB9B/3LcS+cZW8Sg+ef8k/ygARoRkvVo/PcKQUuGFkv4GlwHGvYvc ZBFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738689014; x=1739293814; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xmzhraRgY3zaWlcpx0Qf8YZOZER8wfqA3ogDUyFQ8kg=; b=q9o7QBY8MFqE7Szrv/kXGN9H7Z8PY4MyPsDwYNpKemPMJ95QWhGMnt6ZNOXzpwK1zC w/ZzATMhjvdy+BMH6ZR5vEcyufHSDh4W0ODSdpp5u5cRDCxyMshyeoCJNQ6teaYmABWC NG9iKCm0+Giekszg2pZbxmxIN7gjEhrozYw5Gn66UjI6e50h4D2GYAiJwaN/Czi62KDg bLBRg/cPDNi8cYw4KyJuYSW6GYh5DUcJ8kqD+NIX+42EI8y++/5GkhmDQDQg3b8KrZBa xRnecR/0kedWKECd7FAdS8A1hx7tkU0kCSnxw+cqDW2fDqPM1sfgyPPiDhW3bkY+06fg pjXw== X-Gm-Message-State: AOJu0YzF43RC3svinaeXNTLacfoyah2xZJj9ff8gioLYV281S0ouLJc2 ObKvtFgtj0qnVeW+TvyCfAV1i110hiTACz031kRl03D3B7wHF4Ckydj+IECZHAkIjCGY6gOAT4m /cwECUBKu/tQx6J1ob7zz2mu6AW+6eQ== X-Gm-Gg: ASbGncso25h0LbaHxeb8iAEXltP2VZ0aBAOQuSxB98dIEhg+rDQBNrcQe8urQVWZaDz 5DDFwycJLgnU835ao8fqHDImK3yHIIb47/Jv+vxIIGIzDX4KRNhgDefMzPRYbN1LhnJwr6yKY4R OwWaq5INxxaUHzMPCH2hGIhoRcQ2QWpQk= X-Google-Smtp-Source: AGHT+IEQG3N/lKNoD6hZyZrsD39WwJKNbBV+evBS9dRLZaeXxCAtdJ/d0lh6n1qJBqqw9tWWPA0sP7vaj4eMt0ol3pk= X-Received: by 2002:a05:6870:ff4b:b0:29d:c68e:34d9 with SMTP id 586e51a60fabf-2b32f1b5287mr15120506fac.13.1738689014217; Tue, 04 Feb 2025 09:10:14 -0800 (PST) MIME-Version: 1.0 References: <4e7a338-c7d3-e944-20bd-a6e346e175c7@appl-ecosys.com> <868eea77-7a0c-4fca-b9a3-7a38ffe5087f@gmail.com> In-Reply-To: <868eea77-7a0c-4fca-b9a3-7a38ffe5087f@gmail.com> From: Ron Johnson Date: Tue, 4 Feb 2025 12:10:03 -0500 X-Gm-Features: AWEUYZm9JCHiTt9anSlgmY0oFIjzoIidfxBnYikOf3HO4MTjsD45dGr7bhz2IPY Message-ID: Subject: Re: Lookup tables To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000114543062d541537" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000114543062d541537 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 4, 2025 at 12:05=E2=80=AFPM Rob Sargent = wrote: > > > > On 2/4/25 10:03, Ron Johnson wrote: > > On Tue, Feb 4, 2025 at 11:31=E2=80=AFAM Micha=C5=82 K=C5=82eczek wrote: > [snip] > >> >> The query to register a visit is: >> insert into restaurant_visit >> select $user, current_date, restaurant_id, $rating >> from restaurant where name =3D $restaurant_name >> >> >> 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! >> > > Valid concerns, which means that you add a new restaurant record when the > name changes. > > And there goes your unique index on phone number :) > I don't think I'd ever do that, since phone numbers can get reassigned. Capital-L Large and old businesses probably don't even have unique indices on SSN. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000114543062d541537 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Feb 4, 2025 at 12:05=E2=80=AFPM R= ob Sargent <robjsargent@gmail.c= om> wrote:
=20 =20 =20



On 2/4/25 10:03, Ron Johnson wrote:
=20
On Tue, Feb 4, 2025 at 11:31=E2=80=AFAM Micha=C5= =82 K=C5=82eczek <micha= l@kleczek.org> wrote:
[snip]=C2=A0

The query to register a visit is:
insert into restaurant_visit
select $user, current_date, restaurant_id, $rating
from restaurant where name =3D $restaurant_name


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!

Valid concerns, which means that you add a new restaurant record when the name changes.
And there goes your unique index on phone number :)

I don't think I= 9;d ever do that, since phone numbers can get reassigned.

Capital-L Large and old businesses probably don't even have uni= que indices on SSN.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I= 9;m still alive.
<Redacted> lobster!
--000000000000114543062d541537--