Re: rules and default values

From: Neil Conway <nconway(at)klamath(dot)dyndns(dot)org>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, mojo(at)thewickedtribe(dot)net
Subject: Re: rules and default values
Date: 2002-04-15 18:42:54
Message-ID: 20020415144254.39921398.nconway@klamath.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 15 Apr 2002 14:25:28 -0400
"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Awhile back I said:
> > nconway(at)klamath(dot)dyndns(dot)org (Neil Conway) writes:
> >> In other words, when the insert statement on the view is transformed by
> >> the rule, the "default value" columns are replaced by explicit NULL
> >> values (which is the default value for the columns of the pseudo-table
> >> created by CREATE VIEW). Is this the correct behavior?
>
> > It's correct, from the point of view of the rule rewriter, but that
> > doesn't make the behavior useful.
>
> > What'd make sense to me is to allow defaults to be attached to the
> > view columns, say by doing ALTER TABLE ADD DEFAULT on the view.
> > Unfortunately that won't do much in the current implementation,
> > because such defaults will never get applied (the planner certainly
> > won't see them as applicable).
>
> > Maybe inserting defaults should be the first phase of rewriting, just
> > before rule substitution, rather than being left to the planner as it
> > is now. We took it out of the parser for good reasons, but perhaps
> > we moved it too far downstream.
>
> I recently moved the default-insertion phase to fix a different bug,
> so this is now possible. Given the attached patch, it actually works.

Great!

> However I have not applied the patch because it needs (a) pg_dump
> support and (b) documentation, neither of which I have time for at the
> moment. Anyone want to pick up the ball?

Sure, I'll do this stuff.

Cheers,

Neil

--
Neil Conway <neilconway(at)rogers(dot)com>
PGP Key ID: DB3C29FC

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2002-04-15 19:07:19 regression in CVS HEAD
Previous Message Tom Lane 2002-04-15 18:40:04 Re: Operators and schemas