> -----Original Message-----
> From: Hiroshi Inoue
> Sent: Friday, June 09, 2000 3:02 AM
>
> > -----Original Message-----
> > From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> >
> > "Hiroshi Inoue" <Inoue@tpf.co.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@tpf.co.jp