Rules

Поиск
Список
Период
Сортировка
От Ricardo Bayley
Тема Rules
Дата
Msg-id AANLkTikrQQJZwzr7TuQIwgtB8iWIjQauaFZJmGaPqd8b@mail.gmail.com
обсуждение исходный текст
Список pgsql-admin
Hi Fellows,

I have a table with 55 columns or so, plus one extra column of datatype geometry, I am using PostGIS.
I intend to split my table into 3 tables. So each may have 25 to 30 columns each.

I've  created a View which relates all 3 tables with their pk and fk accordingly. This VIEW has a RULE ..... 

ON INSERT TO public.mytable DO INSTEAD 
I listed 3 ACTIONS in order to insert data into all 3 different tables.

I am having trouble getting the main table´s primary key value. I use the currval('mytable_sequence_id')
It works fine only if I do not insert multiple records at once. If I do insert multiple records, the currval gets the last value and not each inserted value. Hence, all my records in my 2 related tables have foreign key = to the last primary key.

I guess I am doing something wrong, either I am missing something or my approach is incorrect.

Do you know how should I accomplish this ? Any ideas ?


Thanks in advanced.


Ricardo

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Server crash when using dblink_build_sql_* after alter table
Следующее
От: "Gnanakumar"
Дата:
Сообщение: Re: Fatal Error during PITR Recovery