Re: ERROR: column "time" cannot be cast to type bigint - Mailing list pgsql-admin

From Thomas Kellerer
Subject Re: ERROR: column "time" cannot be cast to type bigint
Date
Msg-id ioojn2$91i$1@dough.gmane.org
Whole thread Raw
In response to ERROR: column "time" cannot be cast to type bigint  (Saurabh Agrawal <saurabh.miet@gmail.com>)
List 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


pgsql-admin by date:

Previous
From: Mlondolozi Ncapayi
Date:
Subject: How to uninstall PostgreSQL 8.4 on both Windows XP and Windows 7
Next
From: Mario Splivalo
Date:
Subject: Re: Reseting statistics, cluster wide