pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedERROR: column "time" cannot be cast to type bigint
2+ messages / 2 participants
[nested] [flat]
* ERROR: column "time" cannot be cast to type bigint
@ 2011-04-20 06:38 Saurabh Agrawal <saurabh.miet@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Saurabh Agrawal @ 2011-04-20 06:38 UTC (permalink / raw)
To: pgsql-admin
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.
Regards
Saurabh Agrawal
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: ERROR: column "time" cannot be cast to type bigint
@ 2011-04-21 06:43 Thomas Kellerer <spam_eater@gmx.net>
parent: Saurabh Agrawal <saurabh.miet@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Kellerer @ 2011-04-21 06:43 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2011-04-21 06:43 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 06:38 ERROR: column "time" cannot be cast to type bigint Saurabh Agrawal <saurabh.miet@gmail.com>
2011-04-21 06:43 ` Thomas Kellerer <spam_eater@gmx.net>
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