Re: :PgSQL: More Queestions

Поиск
Список
Период
Сортировка
От Tim Bunce
Тема Re: :PgSQL: More Queestions
Дата
Msg-id 20021121093243.GG381@dansat.data-plan.com
обсуждение исходный текст
Ответ на Re: :PgSQL: More Queestions  (David Wheeler <david@wheeler.net>)
Список 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 по дате отправления:

Предыдущее
От: Tim Bunce
Дата:
Сообщение: Re: DBD::PgSQL: More Queestions
Следующее
От: Tim Bunce
Дата:
Сообщение: Re: DBD::PgSQL: More Queestions