Re: pg_settings.enumval as array - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: pg_settings.enumval as array
Date
Msg-id 4926F987.402@hagander.net
Whole thread Raw
In response to Re: pg_settings.enumval as array  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_settings.enumval as array  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Magnus Hagander <magnus@hagander.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Should enum GUCs be listed as such in config.sgml?
Next
From: Tom Lane
Date:
Subject: Re: pg_settings.enumval as array