Skip site navigation (1) Skip section navigation (2)

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

From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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: 2001-12-17 14:19:54
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
[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));


"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

In response to


pgsql-hackers by date

Next:From: Marc G. FournierDate: 2001-12-17 14:20:21
Subject: Re: Size restriction on patches list
Previous:From: Tatsuo IshiiDate: 2001-12-17 14:12:53
Subject: Re: 7.2 is slow?

pgsql-patches by date

Next:From: Brent VernerDate: 2001-12-17 14:48:58
Subject: Re: [PATCHES] system catalog relation of a table and a serial sequence
Previous:From: Zeugswetter Andreas SB SDDate: 2001-12-17 13:43:10
Subject: Re: [HACKERS] Problem compiling postgres sql --with-tcl

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group