Re: Changing column types... - Mailing list pgsql-hackers

From Gavin Sherry
Subject Re: Changing column types...
Date
Msg-id Pine.LNX.4.21.0204051451460.12721-100000@linuxworld.com.au
Whole thread Raw
In response to Re: Changing column types...  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
On Fri, 5 Apr 2002, Christopher Kings-Lynne wrote:

> > > 2. Since int4 and abstime are binary compatible (ie
> > int4::abstime works), is
> > > there any serious problem with updating a pg_attribute row for
> > an int4 and
> > > changing it to and abstime?  My experiments seem to work.
> >
> > A few integer values are reserved values in abstime, to allow
> > implementation of infinity, -infinity, etc.
> 
> Does this mean that hacking the type of an int4 column to become abstime is
> a bad idea?

The only problem with this would be if the int4 column contained the
reserved values:

#define INVALID_ABSTIME ((AbsoluteTime) 0x7FFFFFFE)     
#define NOEND_ABSTIME   ((AbsoluteTime) 0x7FFFFFFC)
#define NOSTART_ABSTIME ((AbsoluteTime) INT_MIN)

> 
> Yes in theory - no in practice?

Kind of the other way around, in my opinion: No in theory, yes in
practice.

Gavin



pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: Changing column types...
Next
From: Tatsuo Ishii
Date:
Subject: PQescapeBytea is not multibyte aware