Re: pg_execute_from_file, patch v10

Поиск
Список
Период
Сортировка
От Dimitri Fontaine
Тема Re: pg_execute_from_file, patch v10
Дата
Msg-id 87sjy191ur.fsf@hi-media-techno.com
обсуждение исходный текст
Ответ на Re: pg_execute_from_file, patch v10  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Ответы Re: pg_execute_from_file, patch v10  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Itagaki Takahiro <itagaki.takahiro@gmail.com> writes:
> I think the version is almost OK, but I have a couple of comments:
> - Why do you need directory_fctx in genfile.h ?

I then use it in extension.c, this way:

typedef struct extension_fctx
{directory_fctx dir;ExtensionList *installed;
} extension_fctx;

> - It might be reasonable to have 3 and 1 arguments version of pg_read_file.
>   i.e, (path, offset, size) and (path). Two args version (path, offset)
>   doesn't seem to be so useful. In addition, CREATE EXTENSION will always
>   call it with offset=0, no?

Depending on the 'relocatable' property, we now do either of those calls:
execute_sql_file(get_extension_absolute_path(control->script),         pg_encoding_to_char(encoding));
read_text_file_with_endoding(filename,             pg_encoding_to_char(encoding));

So we're using the internal forms only here, and we can propose whatever
API we find best. Reading through the end of the file seems common
enough, but I agree I would prefer reading the whole file here if I had
to pick only one.

> - We don't need some of added #include "utils/array.h" anymore.

Ah yes, true.

Do you want another patch version from me?
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: hstores in pl/python
Следующее
От: Aidan Van Dyk
Дата:
Сообщение: Re: ALTER EXTENSION ... UPGRADE;