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 1tfOHu-0025C3-EA for pgsql-general@arkaria.postgresql.org; Tue, 04 Feb 2025 19:08:46 +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 1tfOHt-007PpR-F1 for pgsql-general@arkaria.postgresql.org; Tue, 04 Feb 2025 19:08:45 +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 1tfOHt-007Poc-3R for pgsql-general@lists.postgresql.org; Tue, 04 Feb 2025 19:08:45 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tfOHq-003AxR-31 for pgsql-general@postgresql.org; Tue, 04 Feb 2025 19:08:44 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 3F98A2A14D6 for ; Tue, 4 Feb 2025 11:08:42 -0800 (PST) Date: Tue, 4 Feb 2025 11:08:42 -0800 (PST) From: Rich Shepard To: pgsql-general@postgresql.org Subject: Re: Lookup tables In-Reply-To: <0def87f9-6fa6-49a7-b0bc-f313c066d387@gmail.com> Message-ID: <4c55f93-bff-a452-69da-6db5a5a33b33@appl-ecosys.com> References: <4e7a338-c7d3-e944-20bd-a6e346e175c7@appl-ecosys.com> <0def87f9-6fa6-49a7-b0bc-f313c066d387@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 4 Feb 2025, Rob Sargent wrote: > Unless your lookup tables are huge I would create a new table matching > your current table but with an identity column and load from you original > table. I created a new table: create table ind_types_lu ( ind_nbr serial primary key, ind_name varchar(32) not null ); Now the database has the new table and a new sequence: public | ind_types_lu | table | rshepard public | ind_types_lu_ind_nbr_seq | sequence | rshepard I want to replace the old lookup table (with no FK) with this one. Can I use: alter table rename ind_types_lu to industrytypes; and have the sequence name changed, too? TIA, Rich