[General] How could it work?

Поиск
Список
Период
Сортировка
От Markus Orlich
Тема [General] How could it work?
Дата
Msg-id 20020409090704.GA2096@orlich.de
обсуждение исходный текст
Ответы Re: [General] How could it work?  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
Suppose you have tables like this:
  table_1                tmp_store              tmp_article
+---------+----------+ +---------+----------+ +---------+----------+
| name    | type     | | name    | type     | | name    | type     |
+---------+----------+ +---------+----------+ +---------+----------+
| dat     | date     | | dat     | date     | | dat     | date     |
| store   | char     | | article | char     | | store   | char     |
| article | char     | | price   | money    | | price   | money    |
| price   | money    | | amount  | smallint | | amount  | smallint |
| amount  | smallint | +---------+----------+ +---------+----------+
+---------+----------+

and an insert like this:
insert into table_1 values ( '08/04/2002', 'aldi', 'hmilch', 0.57, 3 );

Is it possible for each insert
1. verify if a table exists with the name of the (store|article)
   if yes
       a. insert the relevant data
   if no
       a. create a table (store|article) like (tmp_store|tmp_article)
       b. insert the relevant data

I was reading about triggers and functions, but I havn't found an answer
how to create tables in triggers or in functions.

Markus

--
There is no spam like no spam..

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

Предыдущее
От: Mark kirkwood
Дата:
Сообщение: Re: [HACKERS] Re : Solaris Performance - Profiling
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: [General] How could it work?