Re: PL/pgSQL compatibility?

Поиск
Список
Период
Сортировка
От Soma Interesting
Тема Re: PL/pgSQL compatibility?
Дата
Msg-id 5.0.0.25.0.20001208154613.02fc9300@pop.telus.net
обсуждение исходный текст
Ответ на Re: PL/pgSQL compatibility?  ("Joel Burton" <jburton@scw.org>)
Список pgsql-general
At 06:29 PM 12/8/2000 -0500, you wrote:

You understood perfectly what I was trying to express and your answer
helped lots.

> > And going in the other direction. When time comes to add a child
>row,
> > can the DBMS be setup to manage the necessary relations rows
>and
> > parent rows? I'd imagine I would need triggers to accomplish this -
>as
> >  I don't think there is such a thing as a CASCADE INSERT :)
>
>There is no CASCADE INSERT. The rules for INSERT are
>straightforward. You can't add a StudentClass if there isn't a
>referenced Class and a referenced Student (pending DEFERRED; see
>the draft tutorial for info on that.)
>
>If that's not what you want, what exactly do you want to manage
>about the relationship?

In the case of what I'm working on, I'll want to just add a row to
ClassStudent and it will automatically make corresponding semi-blank rows
in Student and Class based on the id's I inserted into ClassStudent. So I
would need to use a trigger for this also. I guess I was wondering if I
could get referential integrity to handle both the trigger you suggested
above and the trigger I'm suggesting - which isn't what referential
integrity is intended for.

In the context of what I'm working on, the related Student rows won't
always exist already and I'm trying to avoid writing PHP code to handle
Inserting a new class row, and inserting the user's requested number of
blank student rows, then inserting the corresponding rows in ClassStudent.

I can't really use a trigger because sometimes existing students will be
added to a class. In which case inserting the appropriate row would set off
the trigger, creating unwanted blank class and student rows.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Help interpreting the output of EXPLAIN
Следующее
От: Barry Lind
Дата:
Сообщение: Bug in index scans with Locale support enabled