From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-admin@postgresql.org
Subject: Re: ERROR: column "time" cannot be cast to type bigint
Date: Thu, 21 Apr 2011 08:43:48 +0200
Message-ID: <ioojn2$91i$1@dough.gmane.org> (raw)
In-Reply-To: <BANLkTi=g3mqZ2WLt6AHFjDzGFUyHfSP1gg@mail.gmail.com>
References: <BANLkTi=g3mqZ2WLt6AHFjDzGFUyHfSP1gg@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: ERROR: column "time" cannot be cast to type bigint
In-Reply-To: <ioojn2$91i$1@dough.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox