Обсуждение: Rules

Поиск
Список
Период
Сортировка

Rules

От
Jake Stride
Дата:
I'm a bit stuck about something (I think) I want to do with rules.

I have 2 schemas in a database - public and company1. I have a view in
company1 that is made with a left outer join on a table from public and
and a table from company1:

public.table
============
id serial

company1.table
==============
public_table_id int references public.table.id
some_data varchar

company.view
============
SELECT public.table.id, company1.table.some_data FROM public.table LEFT
OUTER JOIN company1.table ON
(public.table.id=company1.table.public_table)id)

What I need to do is, when somebody tries to update the view, if the row
does not exist in company1.table insert it, otherwise do an update.

Is using rules the best way to do it and if so how?

Thanks

Jake