Re: ERROR: column "time" cannot be cast to type bigint

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: ERROR: column "time" cannot be cast to type bigint
Date: 2011-04-21 06:43:48
Message-ID: ioojn2$91i$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Saurabh Agrawal, 20.04.2011 08:38:
> Hi All,
>
> I am trying to alter column from "timestamp without timezone" to
> "bigint" but getting below error:
>
> #ALTER TABLE test ALTER column time type bigint;
> #ERROR: column "time" cannot be cast to type bigint
>
> Is there any other method for alter column to bigint.

This should do it:

ALTER TABLE test ALTER column time type bigint USING extract(epoch from time)

(Btw: I would avoid column names that are keywords like "time")

Thomas

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Mario Splivalo 2011-04-21 07:51:12 Re: Reseting statistics, cluster wide
Previous Message raghu ram 2011-04-20 20:49:46 Re: Reseting statistics, cluster wide