Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-08 Thread Greg Smith
On Thu, 7 May 2009, Tom Lane wrote: The tables will be created and used in schema 'a', and the effective search path depth will be the same. The case to be concerned about here is where the search_path changes between initialization and the pgbench run, which certainly isn't impossible.

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-08 Thread Tom Lane
Greg Smith gsm...@gregsmith.com writes: On Thu, 7 May 2009, Tom Lane wrote: The tables will be created and used in schema 'a', and the effective search path depth will be the same. The case to be concerned about here is where the search_path changes between initialization and the pgbench

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Simon Riggs
On Wed, 2009-05-06 at 15:18 -0400, Tom Lane wrote: Dickson S. Guedes lis...@guedesoft.net writes: Em Qua, 2009-05-06 s 09:37 -0400, Tom Lane escreveu: Seems like the right policy for that is run pgbench in its own database. A text warning about this could be shown at start of pgbench

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Robert Haas
On Thu, May 7, 2009 at 10:12 AM, Simon Riggs si...@2ndquadrant.com wrote: On Wed, 2009-05-06 at 15:18 -0400, Tom Lane wrote: Dickson S. Guedes lis...@guedesoft.net writes: Em Qua, 2009-05-06 s 09:37 -0400, Tom Lane escreveu: Seems like the right policy for that is run pgbench in its own

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Simon Riggs
On Thu, 2009-05-07 at 11:14 -0400, Robert Haas wrote: We should check they are the correct tables before we just drop them. Perhaps check for the comment Tables for pgbench application. Not production data on the tables, which would be nice to add anyway. I bet it would be just as good

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Aidan Van Dyk
* Robert Haas robertmh...@gmail.com [090507 11:15]: I bet it would be just as good and a lot simpler to do what someone suggested upthread, namely s/^/pgbench_/ That has the legacy compatibility problem... But seeing as legacy has a: SET search_path TO public; And uses plain table

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Tom Lane
Simon Riggs si...@2ndquadrant.com writes: On Thu, 2009-05-07 at 11:14 -0400, Robert Haas wrote: We should check they are the correct tables before we just drop them. Perhaps check for the comment Tables for pgbench application. Not production data on the tables, which would be nice to add

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Tom Lane
Aidan Van Dyk ai...@highrise.ca writes: ... couldn't we just make new pgbench refer to tables as schema.table where schema is public? I'd prefer not to do that because it changes the amount of parsing work demanded by the benchmark. Maybe not by enough to matter ... or maybe it does.

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Joshua D. Drake
On Thu, 2009-05-07 at 12:47 -0400, Tom Lane wrote: Well, pgbench has been coded this way since forever and we've only seen this one report of trouble. Still, I can't object very hard to renaming the tables to pgbench_accounts etc --- it's a trivial change and the only thing it could break is

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Aidan Van Dyk
* Tom Lane t...@sss.pgh.pa.us [090507 12:53]: Aidan Van Dyk ai...@highrise.ca writes: ... couldn't we just make new pgbench refer to tables as schema.table where schema is public? I'd prefer not to do that because it changes the amount of parsing work demanded by the benchmark. Maybe

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Joshua D. Drake
On Thu, 2009-05-07 at 12:58 -0400, Aidan Van Dyk wrote: True enough... What about making the prefix be configurable, so by default, it could be pgbench_, it could be set to (to force it to use old pgbench names) or set to something. to get it to use a different schema (noting that the

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Aidan Van Dyk
* Joshua D. Drake j...@commandprompt.com [090507 13:02]: On Thu, 2009-05-07 at 12:58 -0400, Aidan Van Dyk wrote: True enough... What about making the prefix be configurable, so by default, it could be pgbench_, it could be set to (to force it to use old pgbench names) or set to

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Simon Riggs
On Thu, 2009-05-07 at 09:53 -0700, Joshua D. Drake wrote: On Thu, 2009-05-07 at 12:47 -0400, Tom Lane wrote: Well, pgbench has been coded this way since forever and we've only seen this one report of trouble. Still, I can't object very hard to renaming the tables to pgbench_accounts etc

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Tom Lane
Joshua D. Drake j...@commandprompt.com writes: On Thu, 2009-05-07 at 12:58 -0400, Aidan Van Dyk wrote: True enough... What about making the prefix be configurable, so by default, it could be pgbench_, it could be set to (to force it to use old pgbench names) or set to something. to get it to

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Tom Lane
Joshua D. Drake j...@commandprompt.com writes: --- a/contrib/pgbench/pgbench.c +++ b/contrib/pgbench/pgbench.c @@ -357,8 +357,6 @@ doConnect(void) return NULL; } - executeStatement(conn, SET search_path = public); - return conn; } Applied along

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Greg Smith
On Thu, 7 May 2009, Aidan Van Dyk wrote: But by dropping the search_path, you're necessarily changing the catalog comparisons and lookups anyways, because your now taking a random search path to follow (which could have multiple entries in it) instead of one guaranteed to be a single, useable

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-07 Thread Tom Lane
Greg Smith gsm...@gregsmith.com writes: On Thu, 7 May 2009, Aidan Van Dyk wrote: You are correct here. Right now, pgbench is guaranteed to be running against a search_path with only one entry in it. If someone runs the new version against a configuration with something like:

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Greg Smith
On Tue, 5 May 2009, Tom Lane wrote: I agree that it probably wasn't considered carefully whether pg_bench should do that; but does anyone see a reason not to change it? I thought of one pretty weak use-case for not making this change, but would wager the additional flexibility here is far

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Tom Lane
Greg Smith gsm...@gregsmith.com writes: I once did some pgbench testing on a system that included a real accounts table in a named schema. pgbench -i will execute drop table if exists accounts. It had already accidentally wiped out the copy of the accounts table on the system during an

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Dickson S. Guedes
Em Qua, 2009-05-06 às 09:37 -0400, Tom Lane escreveu: Greg Smith gsm...@gregsmith.com writes: I once did some pgbench testing on a system that included a real accounts table in a named schema. pgbench -i will execute drop table if exists accounts. It had already accidentally wiped out

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Alvaro Herrera
Dickson S. Guedes wrote: Em Qua, 2009-05-06 às 09:37 -0400, Tom Lane escreveu: Seems like the right policy for that is run pgbench in its own database. A text warning about this could be shown at start of pgbench if the target database isn't named pgbench, for examplo, or just some text

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Tom Lane
Dickson S. Guedes lis...@guedesoft.net writes: Em Qua, 2009-05-06 às 09:37 -0400, Tom Lane escreveu: Seems like the right policy for that is run pgbench in its own database. A text warning about this could be shown at start of pgbench if the target database isn't named pgbench, for examplo,

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Joshua D. Drake
On Wed, 2009-05-06 at 15:13 -0400, Alvaro Herrera wrote: Dickson S. Guedes wrote: Em Qua, 2009-05-06 às 09:37 -0400, Tom Lane escreveu: Seems like the right policy for that is run pgbench in its own database. A text warning about this could be shown at start of pgbench if the

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com writes: I think it would be better that the schema is specified on the command line. Surely that's more work than the issue is worth. It's also inconvenient to use, because you'd have to remember to give the switch both for the -i run and the normal

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Joshua D. Drake
On Wed, 2009-05-06 at 17:42 -0300, Dickson S. Guedes wrote: Em Qua, 2009-05-06 às 16:27 -0400, Tom Lane escreveu: Alvaro Herrera alvhe...@commandprompt.com writes: I think it would be better that the schema is specified on the command line. Surely that's more work than the issue is

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Dickson S. Guedes
Em Qua, 2009-05-06 às 16:27 -0400, Tom Lane escreveu: Alvaro Herrera alvhe...@commandprompt.com writes: I think it would be better that the schema is specified on the command line. Surely that's more work than the issue is worth. It's also inconvenient to use, because you'd have to

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Dickson S. Guedes
Em Qua, 2009-05-06 às 13:49 -0700, Joshua D. Drake escreveu: On Wed, 2009-05-06 at 17:42 -0300, Dickson S. Guedes wrote: Em Qua, 2009-05-06 às 16:27 -0400, Tom Lane escreveu: Alvaro Herrera alvhe...@commandprompt.com writes: I think it would be better that the schema is specified on the

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Tom Lane
Joshua D. Drake j...@commandprompt.com writes: On Wed, 2009-05-06 at 17:42 -0300, Dickson S. Guedes wrote: But, there is the possibility that someone are using an automated script that could be broken by this change? Only if the role pgbench is using as an explicit search_path set. Even

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-06 Thread Tom Lane
Dickson S. Guedes lis...@guedesoft.net writes: So, in a way to avoid the scenario where a ROLE has an explicit search_path set to schemes that already have tables named same as the pgbench's tables, doesn't makes sense also create a pgbench_ suffix for them? Hm, just rename the standard

[HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-05 Thread Joshua D. Drake
Hello, I have been doing some testing with pgbench and I realized that it forces the use of public as its search_path. This is bad if: * You want to run multiple pgbench instances within the same database * You don't want to use public (for whatever reason) This patch removes that ability and

Re: [HACKERS] Patch to fix search_path defencies with pg_bench

2009-05-05 Thread Tom Lane
Joshua D. Drake j...@commandprompt.com writes: I have been doing some testing with pgbench and I realized that it forces the use of public as its search_path. This is bad if: * You want to run multiple pgbench instances within the same database * You don't want to use public (for whatever