Skip site navigation (1) Skip section navigation (2)

Re: rules and default values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: nconway(at)klamath(dot)dyndns(dot)org (Neil Conway)
Cc: pgsql-hackers(at)postgresql(dot)org, mojo(at)thewickedtribe(dot)net
Subject: Re: rules and default values
Date: 2002-03-31 00:26:01
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
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.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Neil ConwayDate: 2002-03-31 01:11:13
Subject: Re: compile bug in HEAD?
Previous:From: Neil ConwayDate: 2002-03-30 23:53:46
Subject: rules and default values

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group