"Jaime Casanova" <[EMAIL PROTECTED]> writes:
> now that you're reviewing the updatable view patch, i think we must
> decide what you're position will be about if the updatable view should
> inherit the base table default values... or if we want to create
> default values for every view if we want they match with the base
> table ones... (fwiw, informix does the former)

I'm inclined to agree that if we create an automatic INSERT rule for a
view, we ought to automatically copy the base table's defaults up to the
view as well.  Otherwise the user will certainly want to do that by
hand, and the whole point of this feature is to eliminate the need to do
obvious things by hand.

I think that this would require adding a flag to pg_attrdef entries to
show whether they were created implicitly or not, so that pg_dump would
know not to dump them.

But wait, what if the user does ALTER SET DEFAULT on the base table ---
shouldn't that then propagate to the view?  Perhaps it would be better
if the implementation didn't explicitly store a default expression
attached to the view, but were willing to "drill down" to the base table
and grab its default.  You could still override that by explicitly
attaching a different default to the view, but 90% of the time this
would be the right thing.

For backwards compatibility we should probably say that this automatic
lifting of base-table defaults happens only if the INSERT rule is
implicitly generated ... if you write a manual INSERT rule you need
manual defaults too.  Or should "propagate default values" become an
explicit attribute of ON INSERT rules?

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to