Re: pg_settings.enumval as array

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_settings.enumval as array
Date: 2008-11-21 18:10:15
Message-ID: 4926F987.402@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> The attached patch changes pg_settings.enumval to be an array of text
>> instead of just a string, per previous discussion and the open items list.
>
>> Comments?
>
> Hmmm ... this coding will fail if any enumval contains a double quote.
> Which is probably not a big problem, but we ought to document the
> restriction somewhere.

Hmm. Know what, I had a code comment about that in there. Then I
re-factored my patch and lost it!

I think a code comment is enough. It would actually be quite silly to
*have* a double quote in an enumval - I doubt it will happen by misake.

Will add back.

> Also, this:
>
>> ! if (len > strlen(separator)-1)
>> ! /* Replace final separator */
>> ! hintmsg[len-strlen(separator)] = '\0';
>
> would read better IMHO as "if (len >= strlen(separator))".

Pfft, result of too much copy/paste. Changed.

> Also, the output datatype should be text[] not cstring[].

Ok, will change. That requires hardcode of 1009? Or should I a #define
to pg_type.h?

//Magnus

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-11-21 18:20:39 Re: pg_settings.enumval as array
Previous Message Tom Lane 2008-11-21 18:03:31 Re: Should enum GUCs be listed as such in config.sgml?