Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr> writes:
> Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)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?
Here's the result:
dim=# \df pg_exe*|replace_*|*binary*
List of functions
Schema | Name | Result data type | Argument data types | Type
------------+-----------------------+------------------+---------------------------+--------
pg_catalog | pg_execute_sql_file | void | text | normal
pg_catalog | pg_execute_sql_file | void | text, name | normal
pg_catalog | pg_execute_sql_file | void | text, name, VARIADIC text | normal
pg_catalog | pg_execute_sql_string | void | text | normal
pg_catalog | pg_execute_sql_string | void | text, VARIADIC text | normal
pg_catalog | pg_read_binary_file | bytea | text, bigint, bigint | normal
pg_catalog | replace_placeholders | text | text, VARIADIC text | normal
(7 rows)
I think that answers fine to your concerns, in that you can manipulate
the low-level functions in order to control each step, or you can use
the higher-level functions and just pass them the arguments you want.
Note that the "name" arguments here are the encoding.
The documentation of the pg_execute_sql_string() function should close
the gap noted by Joshua Tolley about how to format placeholder names,
because it gives examples both using '@schema@' and 's' as names.
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
In response to
Responses
pgsql-hackers by date
| Next: | From: Jeff Davis | Date: 2010-12-01 22:24:22 |
| Subject: Re: crash-safe visibility map, take three |
| Previous: | From: Florian Pflug | Date: 2010-12-01 21:57:18 |
| Subject: Re: improving foreign key locks |