Re: Proposal: functions get_text() or get_url() - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Proposal: functions get_text() or get_url()
Date
Msg-id 603c8f070905181350p5ac2d829i4fd2a525e5e85ee7@mail.gmail.com
Whole thread Raw
In response to Proposal: functions get_text() or get_url()  (Stefan Keller <sfkeller@gmail.com>)
Responses Re: Proposal: functions get_text() or get_url()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, May 18, 2009 at 4:03 PM, Stefan Keller <sfkeller@gmail.com> wrote:
> How to insert a text file into a field in PostgreSQL?
> I'd like to insert a row with fields from a local or remote text file.
> I'd expect functions like get_text() or get_url() in order to do the
> following:
> INSERT INTO collection(id, path, content) VALUES(1, '/tmp/mytext,
> get_text('/tmp/mytext));
> AFAIK there was a get_url in libcurl but I neither find it any more. But
> anyway: This should be part of the core... :->

Putting this into core would have security implications.  The file or
URL would be downloaded by the PostgreSQL server process, not the
client process - therefore I think it would have to be super-user
only, which would make it much less useful.  You'd also need a pretty
rich API to mimic all the crazy thinks a URL-fetching library like
libcurl knows how to do.

Except for very large objects where double-copying must be avoided, it
seems like having the client retrieve and pass the data is a simpler
solution.  That having been said, nobody can stop you from writing
(and submitting) a patch.

...Robert


pgsql-hackers by date:

Previous
From: Stefan Keller
Date:
Subject: Proposal: functions get_text() or get_url()
Next
From: Tom Lane
Date:
Subject: Re: Proposal: functions get_text() or get_url()