Re: :PgSQL: More Queestions - Mailing list pgsql-interfaces

From Tim Bunce
Subject Re: :PgSQL: More Queestions
Date
Msg-id 20021121093243.GG381@dansat.data-plan.com
Whole thread Raw
In response to Re: :PgSQL: More Queestions  (David Wheeler <david@wheeler.net>)
List 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.

Tim.


pgsql-interfaces by date:

Previous
From: Tim Bunce
Date:
Subject: Re: DBD::PgSQL: More Queestions
Next
From: Tim Bunce
Date:
Subject: Re: DBD::PgSQL: More Queestions