Re: [HACKERS] Delaying insertion of default values

From: Vadim Mikheev <vadim(at)krs(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Delaying insertion of default values
Date: 1999-07-08 01:24:20
Message-ID: 3783FDC4.141AA4DB@krs.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
>
> (this happens in transformInsertStmt()). It strikes me that doing this
> in the parser is too early, and it needs to be done later, like after
> the rewriter. Why? Because the rule mechanism stores rules as
> parsetrees. If the above INSERT is part of a rule, then the stored form
> of the rule will look like the rewritten command, with the default
> already attached. This is bad: if I later alter the default for t.b,
> the rule won't get updated.
>
> (I can't currently change the default with ALTER TABLE, I think, but
> sooner or later ALTER TABLE will be fixed. I *can* alter t.b's default

ALTER TABLE could (or should?) re-compile table' rules...

> by dumping the database, changing the CREATE TABLE command for t, and
> reloading --- but the rule still won't be updated, because what's dumped
> out for it will look like "insert into t values (1, 12345);" ! Try it
> and see...)
>
> I am inclined to think that attachment of default values should happen
> in the planner, at the same time that the targetlist is reordered to
> match the physical column order and dummy NULLs are inserted for missing
> columns (ie, expand_targetlist()). Certainly it must happen after the

Why not? Not bad way, imho.

> rule mechanism. Unless I hear objections, I will do that while I am
> cleaning up INSERT processing for the INSERT ... SELECT ... GROUP BY bug.

No objections -:).

Vadim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-07-08 01:57:35 Re: [HACKERS] INSERT VALUES error in ecpg.
Previous Message Bruce Momjian 1999-07-08 01:09:12 Re: [HACKERS] spinlock freeze again