Lists: | pgsql-hackers |
---|
From: | Mark Wong <markwkm(at)gmail(dot)com> |
---|---|
To: | Mark Wong <markwkm(at)gmail(dot)com> |
Cc: | Simon Riggs <simon(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, gabrielle <gorthx(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, David Christensen <david(at)endpoint(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: multiple -f support |
Date: | 2010-07-14 03:03:43 |
Message-ID: | AANLkTikFpzrTRl6392GhatQdwlCWQTXFdSMxh5CP51iv@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi all,
I took a stab at changing this up a little bit. I pushed the logic
that David introduced down into process_file(). In doing so I changed
up the declaration of process_file() to accept an additional parameter
specifying how many files are being passed to the function. Doing it
this way also makes use of the logic for the current single
transaction flag without turning it into dead code.
I also added a check to return EXIT_FAILURE if any error was thrown
from any of the sql files used, thus stopping execution of any further
file. Gabrielle tells me the error echoed in this event is not clear
so there is still a little more work that needs to be done.
Regards,
Mark
Attachment | Content-Type | Size |
---|---|---|
psql-f-v2.patch | application/octet-stream | 4.2 KB |
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Mark Wong <markwkm(at)gmail(dot)com> |
Cc: | Simon Riggs <simon(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, gabrielle <gorthx(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, David Christensen <david(at)endpoint(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: multiple -f support |
Date: | 2011-02-06 16:16:31 |
Message-ID: | 201102061616.p16GGVR19046@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
I assume having psql support multiple -f files is not a high priority or
something we don't want.
---------------------------------------------------------------------------
Mark Wong wrote:
> Hi all,
>
> I took a stab at changing this up a little bit. I pushed the logic
> that David introduced down into process_file(). In doing so I changed
> up the declaration of process_file() to accept an additional parameter
> specifying how many files are being passed to the function. Doing it
> this way also makes use of the logic for the current single
> transaction flag without turning it into dead code.
>
> I also added a check to return EXIT_FAILURE if any error was thrown
> from any of the sql files used, thus stopping execution of any further
> file. Gabrielle tells me the error echoed in this event is not clear
> so there is still a little more work that needs to be done.
>
> Regards,
> Mark
[ Attachment, skipping... ]
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | 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>, David Christensen <david(at)endpoint(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: multiple -f support |
Date: | 2011-02-06 17:07:26 |
Message-ID: | AANLkTinc_aEL2kKddqXsZOBcvp6cO+vkxfH5kuvE=-5i@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
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?
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From: | Simon Riggs <simon(at)2ndQuadrant(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, Mark Wong <markwkm(at)gmail(dot)com>, gabrielle <gorthx(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, David Christensen <david(at)endpoint(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: multiple -f support |
Date: | 2011-02-06 22:18:58 |
Message-ID: | 1297030738.1770.3030.camel@ebony |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, 2011-02-06 at 12:07 -0500, 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?
As Andrew pointed out, IIRC, you can do this with a little shell
programming already.
--
Simon Riggs http://www.2ndQuadrant.com/books/
PostgreSQL Development, 24x7 Support, Training and Services
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | 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>, David Christensen <david(at)endpoint(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: multiple -f support |
Date: | 2011-03-11 12:17:31 |
Message-ID: | 201103111217.p2BCHVL15642@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
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
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
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 |
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
From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | David Christensen <david(at)endpoint(dot)com> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, 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:45:50 |
Message-ID: | AANLkTi=kER88UBU6e2cZJvs1iH9zxAskBp1YvuJCyQ+N@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Mar 11, 2011 at 11:30 AM, David Christensen <david(at)endpoint(dot)com> wrote:
>
> 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.
+1.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company