populating a field automatically

Поиск
Список
Период
Сортировка
От Larry Holish
Тема populating a field automatically
Дата
Msg-id 20010227131308.A1897@badlands.philberts.org
обсуждение исходный текст
Список pgsql-novice
Hello all,

I am trying to populate a field in a table by looking up values from
another table.  Here are my (simplified tables):

CREATE TABLE small(
id char(14),
addr int4,
street char(15),
city char(15),
other text,
infor text,
mation text
);

CREATE TABLE big(
id char(14),
addr int4,
street char(15),
city char(15),
other text,
stuff text
);

I am trying to populate id in table small by looking up the
corresponding addr, street and city in table big.  I am trying to
avoid a JOIN because table big is very large, and table small will not
change once it is constructed (lookups only).  If I populate id into
table small, I can then use a simple, fast query on table small
directly.

My question is, then, how to popluate id in table small without
running each query by hand and inserting the result myself.  Should I
try to use an insert trigger?  I see that pl/pgsql can loop over all
the rows of a table. Is this kind of a function the way to go?  Any
thoughts or suggestions would be appreciated.

--
Larry Holish
<ljholish@speakeasy.net>

В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Permissions
Следующее
От: Heath Johns
Дата:
Сообщение: Re: Permissions