Itagaki Takahiro <itagaki.takah...@gmail.com> writes:
> My suggestion is to introduce pg_read_binary_file() function that can
> read any files in the server, and make CREATE EXTENSION to use the
> function. Of course, pg_execute_[sql|from]_file() can simplify queries

It seems like all you're missing in the current patch is the encoding
option in there. Exposing the internal functions is simple enough and
solves it, but I much prefer the current simple-case user API. Do you
want me to add a variant with an extra 'encoding' parameter?

In this case, CREATE EXTENSION WITH ENCODING … would just use this
variant internally.

I'll send another version of the patch with the following SQL
callable functions:

 - replace_placeholders(text, variadic placeholders[]) returns text
 - pg_read_binary_file(text, offset, length) returns bytea
 - pg_execute_sql_string(text)
 - pg_execute_sql_string(text, encoding)
 - pg_execute_sql_string(text, encoding, variadic placeholders[])
 - pg_execute_sql_file(text)
 - pg_execute_sql_file(text, encoding)
 - pg_execute_sql_file(text, encoding, variadic placeholders[])

I'm not too sure about the EXECUTE syntax variant, are you talking about
a plpgsql block (in which case that's supported for free) or about a new
plain SQL variant of it?

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to