Re: Lookup tables

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Re: Lookup tables
Дата
Msg-id 4c55f93-bff-a452-69da-6db5a5a33b33@appl-ecosys.com
обсуждение исходный текст
Ответ на Lookup tables  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Lookup tables
Список 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 по дате отправления: