On Sat, Nov 15, 2014 at 5:51 PM, David Rowley <dgrowle...@gmail.com> wrote: > With pgbench I can do: > > \setrandom qty 24 25 > then throw a :qty into the query and have pgbench replace that with either > 24 or 25. > > The problem is that this does not work for anything apart from integer > types.
I've got a pending patch here - which I don't think anyone has reviewed - that adds an expression syntax to pgbench: https://commitfest.postgresql.org/action/patch_view?id=1581 Once that patch goes in, I think we should generalize it so that the \set syntax can use not only operators but also functions, like abs(). We could also generalize it to work on data types other than integers, such as strings or (like you're suggesting here) dates, so that you could have a random_date() function. In general I'm pretty skeptical about continuing to expend pgbench by adding more backslash commands and complicating the syntax of the ones we've already got. We can certainly do it that way, but it's kind of a mess. I'd rather have a more general framework to build on. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers