Re: pg_execute_from_file, patch v10 - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: pg_execute_from_file, patch v10
Date
Msg-id 87sjy191ur.fsf@hi-media-techno.com
Whole thread Raw
In response to Re: pg_execute_from_file, patch v10  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Responses Re: pg_execute_from_file, patch v10  (Robert Haas <robertmhaas@gmail.com>)
List 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 by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: hstores in pl/python
Next
From: Aidan Van Dyk
Date:
Subject: Re: ALTER EXTENSION ... UPGRADE;