Re: Proposal: functions get_text() or get_url()

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Stefan Keller <sfkeller(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal: functions get_text() or get_url()
Date: 2009-05-18 20:50:07
Message-ID: 603c8f070905181350p5ac2d829i4fd2a525e5e85ee7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 18, 2009 at 4:03 PM, Stefan Keller <sfkeller(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-05-18 23:10:35 Re: Proposal: functions get_text() or get_url()
Previous Message Stefan Keller 2009-05-18 20:03:16 Proposal: functions get_text() or get_url()