Skip site navigation (1) Skip section navigation (2)

Re: :PgSQL: More Queestions

From: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
To: David Wheeler <david(at)wheeler(dot)net>
Cc: Jeff Urlwin <jurlwin(at)bellatlantic(dot)net>, dbi-dev(at)perl(dot)org,pgsql-interfaces(at)postgresql(dot)org
Subject: Re: :PgSQL: More Queestions
Date: 2002-11-21 09:32:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
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.


In response to


pgsql-interfaces by date

Next:From: Tim BunceDate: 2002-11-21 09:44:39
Subject: Re: DBD::PgSQL: More Queestions
Previous:From: Tim BunceDate: 2002-11-21 09:23:16
Subject: Re: :PgSQL: More Queestions

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group