Re: system catalog relation of a table and a serial sequence

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: system catalog relation of a table and a serial sequence
Date: 2002-03-08 00:55:42
Message-ID: 200203080055.g280tgx23186@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


Brent, do you have a new, final patch that you want to submit for this?

---------------------------------------------------------------------------

Brent Verner wrote:
> [2001-12-16 06:30] Brent Verner said:
> | [2001-12-16 00:42] Tom Lane said:
> | | Brent Verner <brent(at)rcfile(dot)org> writes:
> | | > How about strtok_r? I /really/ like the fact that strtok will
> | | > eat either of the tokens ['"] that might be around the sequence
> | | > name... just call me lazy :-)
> | |
> | | That behavior creates one of the "corner cases" I was alluding to.
> | | Shall I leave the difficulty as an exercise for the student?
> |
> | Ok... I ended up working longer than I'd thought :-)
> |
> | * no strtok were used in this patch. ;-)
> | * Handles both serial-sequences and user-sequences referenced in
> | nextval(...) default column defs.
> | * Loop over tables so we can check wildcard table name in the future
> | per your suggestion. I've only noted a TODO: regarding the wildcard
> | matching.
> | * Instead of using a NULL terminated char** array to hold the collected
> | sequence names, I put in a simple strarray ADT -- mostly so I could
> | have the strarrayContains() test to call from the conditional around
> | dumpSequence(). If this is just dumb, I'll replace it with a simple
> | char** implementation. Did I overlook some utility funcs in the
> | PG source that already does this? If so, I'll gladly use those.
> | * Patch is really attached :-P
>
> This patch needs a fix already... I just realized (while playing with
> this code in a different context) that I forgot to change the malloc
> line in strarrayInit() after typedef'ing strarray as pointer to struct,
> instead of just the struct.
>
> - strarray _ary = (strarray)malloc(sizeof(strarray));
> + strarray _ary = (strarray)malloc(sizeof(struct strarray));
>
> cheers.
> brent
>
> --
> "Develop your talent, man, and leave the world something. Records are
> really gifts from people. To think that an artist would love you enough
> to share his music with anyone is a beautiful thing." -- Duane Allman
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-03-08 00:57:56 Re: patch: INSERT INTO t VALUES (a, b, ..., DEFAULT, ...)
Previous Message Tom Lane 2002-03-08 00:54:34 Re: pg_class -> reltuples?

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-03-08 01:00:02 Re: [PATCHES] system catalog relation of a table and a serial
Previous Message Neil Conway 2002-03-07 22:51:58 Re: Basic DOMAIN Support