views

Started by Andrzej Barszczabout 8 years ago2 messages
#1Andrzej Barszcz
abusinf@gmail.com

Dear hackers,

I would be happy when checkRuleResultList in rewriteDefine.c lost so strict
conditions for returning clause. Are there any reasons to have such
restriction for views ?
What I mean in short:

create view ... as select MAIN_TABLE ... joins ...

1. Updating view means updating MAIN_TABLE
2. I want to return after insert at least primary key

No rule system, no trigger INSTEAD OF give me such possibility but I know
that it's possible after modification of checkRuleResultList.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrzej Barszcz (#1)
Re: views

Andrzej Barszcz <abusinf@gmail.com> writes:

I would be happy when checkRuleResultList in rewriteDefine.c lost so strict
conditions for returning clause. Are there any reasons to have such
restriction for views ?

Uh, so that the results of a query that invokes the rule are well-defined?

If you think that for your application, it's okay for the RETURNING rule
to not bother providing useful data for some columns, you could just have
it return nulls for those. But I don't think it's appropriate for the
system itself to make a value judgement like that. If the columns don't
match up, it could very well be user error, and we should report that.

regards, tom lane