Re: Lookup tables - Mailing list pgsql-general

From Rich Shepard
Subject Re: Lookup tables
Date
Msg-id 4c55f93-bff-a452-69da-6db5a5a33b33@appl-ecosys.com
Whole thread Raw
In response to Lookup tables  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Lookup tables
List pgsql-general
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



pgsql-general by date:

Previous
From: Thiemo Kellner
Date:
Subject: Re: Lookup tables
Next
From: "David G. Johnston"
Date:
Subject: Re: Lookup tables