pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Bunce <Tim.Bunce@pobox.com>
To: David Wheeler <david@wheeler.net>
Cc: Jeff Urlwin <jurlwin@bellatlantic.net>
Cc: dbi-dev@perl.org
Cc: pgsql-interfaces@postgresql.org
Subject: Re: :PgSQL: More Queestions
Date: Thu, 21 Nov 2002 09:32:43 +0000
Message-ID: <20021121093243.GG381@dansat.data-plan.com> (raw)
In-Reply-To: <A94E346C-FCFE-11D6-8943-0003931A964A@wheeler.net>
References: <OEEMJFLOJPABMFADAPIKKECEEDAA.jurlwin@bellatlantic.net>
	<A94E346C-FCFE-11D6-8943-0003931A964A@wheeler.net>

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.



view thread (22+ messages)  latest in thread

Message-ID: <20021121093243.GG381@dansat.data-plan.com>
Permalink:  ../20021121093243.GG381@dansat.data-plan.com/
Also on:    postgresql.org/message-id/20021121093243.GG381@dansat.data-plan.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: Tim.Bunce@pobox.com, david@wheeler.net, jurlwin@bellatlantic.net, dbi-dev@perl.org
  Subject: Re: :PgSQL: More Queestions
  In-Reply-To: <20021121093243.GG381@dansat.data-plan.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox