Re: pg_execute_from_file review - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: pg_execute_from_file review
Date
Msg-id 87sjyh34dt.fsf@hi-media-techno.com
Whole thread Raw
In response to Re: pg_execute_from_file review  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Responses Re: pg_execute_from_file review  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
List pgsql-hackers
Itagaki Takahiro <itagaki.takahiro@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,
variadicplaceholders[])- 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


pgsql-hackers by date:

Previous
From: ghatpande@vsnl.net
Date:
Subject: Re: Proposal: First step towards Intelligent, integrateddatabase
Next
From: Dimitri Fontaine
Date:
Subject: Re: KNNGIST next step: adjusting indexAM API