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 1tfK7T-001PpV-FD for pgsql-general@arkaria.postgresql.org; Tue, 04 Feb 2025 14:41:43 +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 1tfK7S-003trM-Dg for pgsql-general@arkaria.postgresql.org; Tue, 04 Feb 2025 14:41:42 +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 1tfK7S-003trE-3F for pgsql-general@lists.postgresql.org; Tue, 04 Feb 2025 14:41:42 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tfK7P-003FOS-16 for pgsql-general@postgresql.org; Tue, 04 Feb 2025 14:41:41 +0000 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3ebc678b5c9so3105081b6e.3 for ; Tue, 04 Feb 2025 06:41:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738680098; x=1739284898; darn=postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=kEP68Nh6MLuc8G0b2Dw9mVr31MJVF25gUuRPzS1ezQk=; b=T48RwixydUxJZJG+/FBzZLTJ2o5tQUrml9g+xPyNNg++NbHyTY7+ox47QH3E6RJPAC NuzNMdjz+m0Z4Hea+rmIhAGIiFEKzSt7o4aKXJeGb75JWGUcUwKTZK74WSNFjIB6korR 16vrcUiGTxIKuslG+CeAMEW6NsW5s86Y1HP1KKBj8Fb9efxi9DA6oObj3ELOwnDkeYxj 536r0IJpAQUSI/yBmmrSo4WwjcNt/FRDgfraB3WIYRF55OdcnCXtCaTqfW3KyHTY8MHG IeyPxQJRhhkI016hF3bRxwxWzMur+6JUX6xdxzEYchWz6ll6q9JKYs6MMfkQs13+XYbN tctA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738680098; x=1739284898; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kEP68Nh6MLuc8G0b2Dw9mVr31MJVF25gUuRPzS1ezQk=; b=BtOsNjPWscIZMuennfuSEV+GdDVhcjmyGKkZcZjbTdOyZb1w/jK8Q9dzIWTigNTVu6 iYMWdfiqnBFHhsE8Tdw/hyghSKIW06JDK8Av5murHh5g+Dqii7HE+E0Dn4UQ6L2cS/c8 jTaeTCU/lUFTfijvF7I2J9LH1ClmoyQCVozPqohPbZS3ihkcZ+LIZxl+qipZOwMVhQgF /Yjt2Piqnt1eSfoAcx+LMPDChgGuvGSRp50FOjM5huirJU0ABvtqmqYalStHMacRhjOw kJZbqtmBCwdUpeq0cKNIZTCIuDP+OvzkEvwmM8irZ/KA9mi/jzvyl84lS+dCmwi/cYD9 K9Ag== X-Gm-Message-State: AOJu0Yw9KC2SGgwx050+pKYUUuLWDMBxZ1EZLO2KtJ4W1G4xGPmIWLTt /wZYbCQyUkmtxAUO8iZ3hvz17hH3Zt+lLycY53gGHhvaiUIXAxSb/Tcifdx22gTJSHGh27azn8L pjdhpyvR9TAPEmdrEEY6NJho/+Zk= X-Gm-Gg: ASbGnctEmbA4tjI4WWtAd0jLHNSsXUQX4M2NCAULjYxRluniQ3kln9b91+fwW1Hh3uA 7NEpYDuAGNw5Pu542mYnUuUvDiz1D8dqSw4wWZudy3uqEoVPTzSW7lI8TVGKo7ZH1nXj3qjw= X-Google-Smtp-Source: AGHT+IHC1+7XfUGn3RXVeLJtEyFRCkisn0tWnxKMSoxL/hhYOMp359yd5LKZAfWw2YL+pCrBNxJ9GdcvizyCmqMIyR4= X-Received: by 2002:a05:6808:3c99:b0:3e6:14a6:4288 with SMTP id 5614622812f47-3f323a3c62amr18029455b6e.11.1738680098061; Tue, 04 Feb 2025 06:41:38 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a05:6802:a0c:b0:577:9519:f64a with HTTP; Tue, 4 Feb 2025 06:41:37 -0800 (PST) In-Reply-To: <4e7a338-c7d3-e944-20bd-a6e346e175c7@appl-ecosys.com> References: <4e7a338-c7d3-e944-20bd-a6e346e175c7@appl-ecosys.com> From: "David G. Johnston" Date: Tue, 4 Feb 2025 07:41:37 -0700 X-Gm-Features: AWEUYZlOsbwDP7JyRrS_9Azf_9tIh5rQHe91zF8ngRWZC2tC8QEbaKnykJANPi8 Message-ID: Subject: Re: Lookup tables To: Rich Shepard Cc: "pgsql-general@postgresql.org" Content-Type: multipart/alternative; boundary="0000000000009f855e062d52015a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000009f855e062d52015a Content-Type: text/plain; charset="UTF-8" On Tuesday, February 4, 2025, Rich Shepard wrote: > Should lookup tables have a numeric FK column as well as the description > column? > > If so, how should I add an FK to the two lookup tables in my database? > Most do (have a surrogate PK) since it removes cascading updates and is a smaller value. Lots of alter tables and update queries. David J. --0000000000009f855e062d52015a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tuesday, February 4, 2025, Rich Shepard <rshepard@appl-ecosys.com> wrote:
Should lookup tables have a numeric FK column as well as the= description column?

If so, how should I add an FK to the two lookup tables in my database?

Most do (have a surrogate PK) since it rem= oves cascading updates and is a smaller value.

Lot= s of alter tables and update queries.

David J. --0000000000009f855e062d52015a--