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: | 20021121093243.GG381@dansat.data-plan.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
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.
Tim.
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Bunce | 2002-11-21 09:44:39 | Re: DBD::PgSQL: More Queestions |
Previous Message | Tim Bunce | 2002-11-21 09:23:16 | Re: :PgSQL: More Queestions |