From: | David Christensen <david(at)endpoint(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Magnus Hagander <magnus(at)hagander(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Explicit psqlrc |
Date: | 2010-03-08 06:39:36 |
Message-ID: | 4D017A1C-82B6-4EBA-B9D3-66A10CA7B156@endpoint.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mar 7, 2010, at 9:22 AM, Tom Lane wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> 2010/3/6 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>> The analogy I was thinking about was psql -X, but I agree that it's
>>> not obvious why this shouldn't be thought of as an additional -f
>>> file.
>
>> Uh, I don't follow. When we use -f, we'll run the script and then
>> exit. The whole point is to run it and *not* exit, since you are
>> normally using it to set up the environment in psql.
>
> If we were going to support multiple -f options, it would be sensible
> to interpret "-f -" as "read from stdin until EOF". Then you could
> interleave prepared scripts and stdin, which could be pretty handy.
> The default behavior would be equivalent to a single instance of "-f
> -",
> and what you are looking for would be "-X -f substitute-psqlrc -f -".
Here's an initial stab at supporting multiple -f's (not counting the
interpretation of "-f -" as STDIN). There are also a few pieces that
are up for interpretation, such as the propagation of the return value
of the MainLoop(). Also, while this patch supports the single-
transaction mode, it does so in a way that will break if one of the
scripts include explicit BEGIN/COMMIT statements (although it is no
different than the existing code in this regard).
Regards,
David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com
Attachment | Content-Type | Size |
---|---|---|
psql_process_multiple_files.patch | application/octet-stream | 2.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Pierre C | 2010-03-08 09:17:55 | Re: SQL compatibility reminder: MySQL vs PostgreSQL |
Previous Message | Takahiro Itagaki | 2010-03-08 06:31:44 | Re: Visual Studio 2005, C-language function - avoiding hacks? |