Re: Add \i option to bring in the specified file as a quoted literal

From: Piotr Marcinczyk <pmarcinc(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: Add \i option to bring in the specified file as a quoted literal
Date: 2013-11-25 22:28:11
Message-ID: 1385418491.18347.7.camel@centos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2013-11-22 at 09:54 -0300, Alvaro Herrera wrote:
> Amit Kapila escribió:
> > On Fri, Nov 22, 2013 at 1:33 AM, Alvaro Herrera
> > <alvherre(at)2ndquadrant(dot)com> wrote:
>
> > > \ib homer ~/photos/homer.jpg
> > > insert into people (name, photo) values ('Homer', :homer);
> >
> > Isn't something similar already supported as mentioned in docs:
> >
> > One example use of this mechanism is to copy the contents of a file
> > into a table column. First load the file into a variable and then
> > interpolate the variable's value as a quoted string:
> >
> > testdb=> \set content `cat my_file.txt`
> > testdb=> INSERT INTO my_table VALUES (:'content');
> >
> > or do you prefer an alternative without any kind of quote using \ib?
>
> If the only use case of the feature proposed in this thread is to load
> stuff from files to use as column values, then we're pretty much done,
> and this patch is not needed -- except, maybe, that the `` is unlikely
> to work on Windows, as already mentioned elsewhere. But if the OP had
> something else in mind, let's hear what it is.
>
I've test set command mentioned above, and I think it is enough. At this
moment I see no point in implementing new command.

Best Regards
Piotr Marcinczyk

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2013-11-25 22:52:54 Re: Put json type into alphabetical order in manual table
Previous Message Kevin Grittner 2013-11-25 22:24:25 Re: [GENERAL] pg_upgrade ?deficiency