RE: DROP COLUMN status

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>, "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: RE: DROP COLUMN status
Date: 2000-06-09 00:10:57
Message-ID: 000b01bfd1a7$2faeed40$2801007e@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Hiroshi Inoue
> Sent: Friday, June 09, 2000 3:02 AM
>
> > -----Original Message-----
> > From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> >
> > "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp> writes:
> > > The implementation makes the dropped column invisible by
> > > changing its attnum to -attnum - offset(currently 20) and
> > > attnam to ("*already Dropped%d",attnum).
> >
> > Ugh. No wonder you had to hack so many places in such an ugly fashion.
> > Why not leave the attnum as-is, and just add a bool saying "column is
> > dropped" to pg_attribute?
>
> Anyway I had hidden details behind MACROs mostly so it
> wouldn't be so difficult to change the implementation as
> you suggests.
>

I'm using the following macros(in pg_attribute.h) in my implementation.
DROP_COLUMN_INDEX() is used only once except pg_attribute.h.
If there are COLUMN_IS_DROPPED() macros,doesn't it mean that
they should be changed at any rate ?

#ifdef _DROP_COLUMN_HACK__
/*
* CONSTANT and MACROS for DROP COLUMN implementation
*/
#define DROP_COLUMN_OFFSET -20
#define COLUMN_IS_DROPPED(attribute) ((attribute)->attnum <=
DROP_COLUMN_OFFS
ET)
#define DROPPED_COLUMN_INDEX(attidx) (DROP_COLUMN_OFFSET - attidx)
#define ATTRIBUTE_DROP_COLUMN(attribute) \
Assert((attribute)->attnum > 0); \
(attribute)->attnum = DROPPED_COLUMN_INDEX((attribute)->attnum); \
(attribute)->atttypid = (Oid) -1; \
(attribute)->attnotnull = false; \
(attribute)->atthasdef = false;
#endif /* _DROP_COLUMN_HACK__ */

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Erich Stamberger 2000-06-09 00:25:52 Re: Sigh, LIKE indexing is *still* broken in foreign locales
Previous Message Bruce Momjian 2000-06-08 21:20:59 Re: Proposal: TRUNCATE TABLE table RESTRICT