database design questions

Поиск
Список
Период
Сортировка
От Ottavio Campana
Тема database design questions
Дата
Msg-id 4431334B.90400@campana.vi.it
обсуждение исходный текст
Ответы Re: database design questions  ("Tomi NA" <hefest@gmail.com>)
Re: database design questions  (Keary Suska <hierophant@pcisys.net>)
Re: database design questions  (Alban Hertroys <alban@magproductions.nl>)
Re: database design questions  ("hubert depesz lubaczewski" <depesz@gmail.com>)
Список pgsql-general
Hello,

I'm designing a  database and I'm having  some problems, so I  ask you a
suggestion.

1) The database I'm going to develop is  a big list with a catalog of
items and I  want to  store subsets  of this  list representing  the
available items in several places.

My idea  is to create the  big table with  all the elements and  then to
create another  table, where each  row holds a pair  (id_item, id_place)
and  thanks to  this create  several views,  joining the  two tables
and selecting the rows with a give id_place.

Do you think it's too heavy? Is there a simpler way to do it?

2) do you think it's possible in  a plpgsql procedure select the name of
a table into a variable and use that variable in the query?

I mean, can I do something like

SELECT INTO table_name get_table_name();
SELECT * FROM table_name;

?

3) faq 4.11.1 says

>    CREATE TABLE person (
>        id   SERIAL,
>        name TEXT
>    );
>
>is automatically translated into this:
>
>    CREATE SEQUENCE person_id_seq;
>    CREATE TABLE person (
>        id   INT4 NOT NULL DEFAULT nextval('person_id_seq'),
>        name TEXT
>    );

how can I do it with a INT8 instead of a INT4?

Thank you

--
Non c'è più forza nella normalità, c'è solo monotonia.


Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Performance Killer 'IN' ?
Следующее
От: "Tomi NA"
Дата:
Сообщение: Re: database design questions