Re: generic reloptions improvement

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: generic reloptions improvement
Дата
Msg-id 20090104213108.GD26552@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: generic reloptions improvement  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: generic reloptions improvement  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
Alvaro Herrera wrote:

> Some notes about this patch:
>
> - the string type handling (basically all the new code) is untested.
> I'll have a look tomorrow at the btree test code I sent the other day to
> add a string option and see how it goes.

Okay, it was basically fine except for the attached minor correction.
Warning: I intend to commit this patch fairly soon!

As far as I can see, the new code can work with the options you've
defined in the SEPgsql code just fine.  Handling string options in
itself is fine; the complexity (as I already said) is in allocating
memory for the string if you want to store it unchanged in the bytea
stuff in relcache.  Since you're not storing the string itself but
convert it to an Oid, there's no problem.

Actually, storing the string itself works fine as long as you have a
single one, because you can define the option struct like this:

/* must follow StdRdOptions conventions */
typedef struct BtOptions
{
    int32    vl_len_;
    int        fillfactor;
    char    teststring[1];
} BtOptions;

and there are no pointers involved.  This doesn't work:

typedef struct BtOptions
{
    int32    vl_len_;
    int        fillfactor;
    char    *teststring;
} BtOptions;

because then there's a pointer, and it fails as soon as the bytea * is
copied by the relcache code.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Joe Conway
Дата:
Сообщение: dblink vs SQL/MED - security and implementation details
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: generic reloptions improvement