How to add column in pg_class
Hello
can any one tell me how can I add a new cloumn in pg_class
Currently I am doing :
In pg_class.h
* In CATALOG(pg_class) BOOTSTRAP define the variable [var-name]
* define a variable for [var-name] as
#define Anum_pg_class_[var-name] [value]
* And pass default value to DATA macro for that variable.
* Change the value of
Natts_pg_class_fixed from 25 to 26
Natts_pg_class from 26 to 27.
In pg_attribute
* in #define Schema_pg_class added proper values for that [var-name].
* Then provided value to DATA macro for [var-name].
In heapam.c
I add 0 in pg_class for that variable and perform simple
heap_update for related tuple in pg_class..
In this way
1. when I add variable after relacl in pg_class, it
adds null for [var-nam] for tuples added in initdb.
2. when I creates a new table, it does not add the
values I specified.
When I place it before relacl, initdb exits with a segmentation fault.
Is there any other file in which I have to make change ?????
Regards
Rafaqat Ali
Rafaqat Ali <smoken0@gmail.com> writes:
Is there any other file in which I have to make change ?????
Fooling with any of the bootstrapped catalogs is pretty messy.
You might grab this patch from the CVS server for comparison:
2005-03-29 14:44 tgl
* doc/src/sgml/bki.sgml, doc/src/sgml/catalogs.sgml,
src/backend/bootstrap/bootstrap.c, src/backend/catalog/pg_proc.c,
src/include/catalog/catversion.h,
src/include/catalog/pg_attribute.h, src/include/catalog/pg_class.h,
src/include/catalog/pg_proc.h: Add proallargtypes and proargmodes
columns to pg_proc, as per my earlier proposal for OUT parameter
support. The columns don't actually *do* anything yet, they are
just left NULLs. But I thought I'd commit this part separately as
a fairly pure example of the tasks needed when adding a column to
pg_proc or one of the other core system tables.
Whatever you're doing in heapam.c is probably wrong, too. There is no
reason for that file to be involved in a system catalog extension ---
it operates at too low a level.
regards, tom lane