Re: pg_execute_from_file, patch v10

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_execute_from_file, patch v10
Date: 2010-12-15 02:25:06
Message-ID: AANLkTinj3AprMFcS4kVRDqLiEE=YYEN2azmenGFwW6A3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 15, 2010 at 03:42, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>>> I think #2 might be a nice thing to have, but I'm not sure what it has
>>> to do with extensions.
>>
>> Agreed.  There might be some use for #4 in connection with extensions,
>> but I don't see that #2 is related.
>>
>> BTW, it appears to me that pg_read_file expects server encoding not
>> client encoding.  Minor detail only, but let's be clear what it is
>> we're talking about.

EXTENSION will use #2 with convert_from() for $4 like this:

Datum sql = replace(
convert_from(pg_read_binary_file($path), $encoding),
'@extschema@', $schema);
SPI_exec(TextDatumGetCString(sql));

I think it is a more flexible solution than adding 'encoding'
parameter to pg_read_file().

--
Itagaki Takahiro

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-12-15 03:20:48 Re: pg_execute_from_file, patch v10
Previous Message Robert Haas 2010-12-15 01:52:01 Re: Per-column collation