Re: How to implement an auto-increment column for a system catalog table?

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Xin Wang <andywx(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: How to implement an auto-increment column for a system catalog table?
Date: 2009-03-16 08:46:33
Message-ID: 1237193193.3963.55.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Mon, 2009-03-16 at 10:18 +0800, Xin Wang wrote:

> I am using Postgres to build the prototype in a research project. I need
> to create a new system catalog table with an auto-increment column. For
> a ordinary table, CREATE SEQUENCE or a serial type can be used to
> implement the auto-increment column, but it seems Postgres do not
> support creating a sequence or serial types in system catalogs. How to
> implement an auto-increment column for a catalog table?

Other catalog tables use a new oid for each new row/entry. Just do it in
the code for adding each new entry. Look at backend/catalog/heap.c
heap_create_with_catalog(), or something simpler like
backend/commands/dbcommands.c createdb().

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikhil Sontakke 2009-03-16 09:07:11 cross-compiling plpython
Previous Message Ron Mayer 2009-03-16 06:30:07 Re: hstore improvements?