Re: Patch to fix search_path defencies with pg_bench - Mailing list pgsql-hackers

From Greg Smith
Subject Re: Patch to fix search_path defencies with pg_bench
Date
Msg-id alpine.GSO.2.01.0905060141250.13274@westnet.com
Whole thread Raw
In response to Re: Patch to fix search_path defencies with pg_bench  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Patch to fix search_path defencies with pg_bench  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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 more likely to be 
appreciated.  I'd say it's a clear net improvement.

As for that case...many good database designs put all the user relations 
into a schema, so that it's easier to do bulk operations on all of them 
while avoiding catalog tables etc.--less work to filter out pg_class to 
find them for example.

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 earlier test, before the schema 
policy was in place, leaving everyone wary of it.

I was able to defend the risk for running pgbench with the new schema 
layout by saying "that can only execute against public.accounts no matter 
what the user search_path is, so you're safe now".  That made everybody 
happy.  Anyone counting on such behavior could be rudely surprised at this 
change.  For all I know I'm the only person to ever actually run into that 
particular situation though.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD


pgsql-hackers by date:

Previous
From: Asko Oja
Date:
Subject: Re: create if not exists (CINE)
Next
From: Bernd Helmle
Date:
Subject: Re: bytea vs. pg_dump