Re: pgbench \for or similar loop - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pgbench \for or similar loop
Date
Msg-id 1303162423-sup-5894@alvh.no-ip.org
Whole thread Raw
In response to Re: pgbench \for or similar loop  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: pgbench \for or similar loop  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Excerpts from Merlin Moncure's message of lun abr 18 18:26:54 -0300 2011:
> On Mon, Apr 18, 2011 at 4:02 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:

> > begin;
> > \for iterator 1 10000
> >  \setrandom foo 1 :iterator
> >  insert into foo values (:foo);
> > \end
> > commit;
> >
> > Would something like this be acceptable?
> 
> *) what does this do that isn't already possible with 'DO' (not being
> snarky, genuinely curious)?

Uhm, not sure.  I'm not really used to having DO available so I didn't
think about it.  I'll look at it a bit more.

> *) should psql get some of these features?  simple logic and looping
> would be a nice addition?

I dunno.  They have been proposed and shot down in the past.  Apparently
people don't want psql to become too powerful.  ("But that would make
psql turing complete! Soon you're going to want to have \while on it!").
I think pgbench is supposed to be designed to handle data in bulk which
is why I started using it for this in the first place.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: HTML tags :/
Next
From: Alvaro Herrera
Date:
Subject: Re: HTML tags :/