Skip site navigation (1) Skip section navigation (2)

Re: pg_execute_from_file review

From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
Cc: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, Joshua Tolley <eggyknap(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_execute_from_file review
Date: 2010-12-01 15:21:50
Message-ID: 87sjyh34dt.fsf@hi-media-techno.com (view raw or flat)
Thread:
Lists: pgsql-hackers
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?

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

In response to

Responses

pgsql-hackers by date

Next:From: Dimitri FontaineDate: 2010-12-01 15:24:17
Subject: Re: KNNGIST next step: adjusting indexAM API
Previous:From: Euler Taveira de OliveiraDate: 2010-12-01 15:16:00
Subject: Re: Hi- How frequently Postgres Poll for trigger file

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group