Re: multiple -f support

From: David Christensen <david(at)endpoint(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Mark Wong <markwkm(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, gabrielle <gorthx(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: multiple -f support
Date: 2011-03-11 16:30:36
Message-ID: 82B487B4-16B9-4A4D-8B96-4A221320F436@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Mar 11, 2011, at 6:17 AM, Bruce Momjian wrote:

> Robert Haas wrote:
>> On Sun, Feb 6, 2011 at 11:16 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>>> I assume having psql support multiple -f files is not a high priority or
>>> something we don't want.
>>
>> IIRC, nobody objected to the basic concept, and it seems useful. I
>> thought we were pretty close to committing something along those lines
>> at one point, actually. I don't remember exactly where the wheels
>> came off.
>>
>> Maybe a TODO?
>
> Added to the psql section:
>
> |Allow processing of multiple -f (file) options

The original patch was a fairly trivial WIP one, which I started working on to add support for multiple -c flags interspersed as well. I haven't looked at it in quite some time, though; there had been some concerns about how it worked in single-transaction mode and some other issues I don't recall off the top of my head.

On this topic, I was thinking that it may be useful to provide an alternate multi-file syntax, a la git, with any argument following '--' in the argument list being interpreted as a file to process; i.e.,:

$ psql -U user [option] database -- file1.sql file2.sql file3.sql

This would allow things like shell expansion to work as expected:

$ ls
01-schema.sql 02-data1.sql 03-fixups.sql

$ psql database -- *.sql

etc.

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-03-11 16:40:28 Re: Flex output missing from 9.1a4 tarballs?
Previous Message Alvaro Herrera 2011-03-11 16:08:36 Re: Couple document fixes