Re: [gnome-db] Changing a field definition



On Mon, 2004-05-31 at 01:40 +0200, Rodrigo Moya wrote:
> On Wed, 2004-05-05 at 11:20 +0000, Murray Cumming wrote:
> > I'm still in favour of explicit methods like
> > gda_connection_change_field_definition(tablename, GdaFieldAttributes).
> > 
> > I'm not sure how well this can actually work because
> > - I don't know how well the GdaValueTypes map to underlying database
> > types.
> >
> the providers should map them correctly.

Some providers can even use custom types, so I don't think that's
possible.

> > - Changing a field definition will often be slow and lossy, and is
> > sometimes very difficult - postgres needs us to create a new column,
> > copy the data across, delete the original, and rename.
> > 
> I would prefer something that allows changing several fields at once.
> So, for instance, the modify_table method you mentioned, containing, as
> parameters, a list of the fields to be changed. How does that sound?

In my case, I need to change just one field at a time, though I can see
how it would be useful to create an entire table definition at once.

However, my investigations of postgres show that this is an almost
impossible goal with postgres if we expect to preserve the data in the
field, because there are various methods to do it depending on the
source and destination field type.

If we don't expect to preserve the date then it's easy - you just add a
new column, rename the old and new columns, and remove the old column.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]