On Thu, Jun 26, 2014 at 7:59 AM, James Le Cuirot
<chewi@aura-online.co.uk> wrote:
> On Thu, 26 Jun 2014 07:23:02 -0500
> Merlin Moncure <mmoncure@gmail.com> 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