Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 668AA475D20 for ; Thu, 21 Nov 2002 04:33:44 -0500 (EST) Received: from mail01.svc.cra.dublin.eircom.net (mail01.svc.cra.dublin.eircom.net [159.134.118.17]) by postgresql.org (Postfix) with SMTP id 14B564758DC for ; Thu, 21 Nov 2002 04:32:45 -0500 (EST) Received: (qmail 3399 messnum 119824 invoked from network[159.134.166.246/p758.as1.limerick1.eircom.net]); 21 Nov 2002 09:32:45 -0000 Received: from p758.as1.limerick1.eircom.net (HELO dansat.data-plan.com) (159.134.166.246) by mail01.svc.cra.dublin.eircom.net (qp 3399) with SMTP; 21 Nov 2002 09:32:45 -0000 Received: from dansat.data-plan.com (localhost [127.0.0.1]) by dansat.data-plan.com (8.12.6/8.12.6) with ESMTP id gAL9Wiao017008; Thu, 21 Nov 2002 09:32:44 GMT (envelope-from timbo@dansat.data-plan.com) Received: (from timbo@localhost) by dansat.data-plan.com (8.12.6/8.12.6/Submit) id gAL9Whb0017007; Thu, 21 Nov 2002 09:32:43 GMT Date: Thu, 21 Nov 2002 09:32:43 +0000 From: Tim Bunce To: David Wheeler Cc: Jeff Urlwin , dbi-dev@perl.org, pgsql-interfaces@postgresql.org Subject: Re: :PgSQL: More Queestions Message-ID: <20021121093243.GG381@dansat.data-plan.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/135 X-Sequence-Number: 3383 On Wed, Nov 20, 2002 at 07:09:34PM -0800, David Wheeler wrote: > > PostgreSQL folks, can the same statement return a different number of > fields on different executes? I'm guessing yes for something like this, > though: > > CREATE TABLE foo ( bar int, bat, text); > > SELECT * FROM foo; -- Returns two fields. > > ALTER TABLE foo ADD COLUMN fat int; > > SELECT * FROM foo; -- Returns three fields. I suspect there are quite a few drivers that wouldn't do the right thing in that situation (schema change between two executes of a prepared statement). You could either arrange the code to ignore an extra column (on the right), or make it re-describe if the column count changes. But they'll always be ways to cause problems - such as changing the type of a column. Increasing paranoia yields decreasing performance. I doubt it's worth worrying about. In general people should avoid "select *" if there's a risk that the schema will change. Tim.