Search Postgresql Archives

Re: Alternative to psql -c ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 26, 2014 at 7:59 AM, James Le Cuirot
<chewi@xxxxxxxxxxxxxxxxx> wrote:
> On Thu, 26 Jun 2014 07:23:02 -0500
> Merlin Moncure <mmoncure@xxxxxxxxx> wrote:
>> To be clear, Tom was advising not to rely on some of the quirky
>> aspects of -c.  psql as it stands right now has a some limitations:
>> single transaction mode does not work with stdin and there is no
>> reasonable way to pass multiple scripts through the command line.
>> Adding it up this means that for generic multiple .sql passing you
>> have to wrap psql with a script.
>
> I never said that I wanted to pass multiple scripts, just singular
> scripts who's contents might be too large for the command line limit,
> and that they might contain transaction statements.

yup.  Passing huge scripts via -c is definitely not a good practice.
-c is designed for things like firing off a stored procedure from cron
or bash variable assignment (for example: FOO=`psql -tXAqc"select
bar()"`)

> These scripts come from a Ruby string buffer so passing them via stdin
> would be preferable to having to dump them out to a file first. You say
> that single transaction mode doesn't work with stdin but it looks like
> this was fixed in 9.3.

yup -- i keep forgetting that.  too many years of not having it i suppose.

merlin



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux