Unix Technical Forum

ALTER COLUMN from date to timestamp without time zone

This is a discussion on ALTER COLUMN from date to timestamp without time zone within the Pgsql General forums, part of the PostgreSQL category; --> I am trying to figure out how to alter a column's data type from a date to a timestamp ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 08:58 AM
littlebitshell
 
Posts: n/a
Default ALTER COLUMN from date to timestamp without time zone

I am trying to figure out how to alter a column's data type from a date
to a timestamp without time zone. Is this possible or do I have to
drop the column and then add it back with the correct data type? Below
is the table:

rpdb3=# \d reports
Table "public.reports"
Column | Type | Modifiers
----------------------+--------------+-----------
day | date | not null
hbt | character(2) | not null
chain | character(2) | not null
pass | integer | not null

Indexes:
"reports_pkey" primary key, btree ("day", hbt, chain)


I need the table to be:

rpdb3=# \d reports
Table "public.reports"
Column | Type | Modifiers
----------------------+--------------+-----------
day | timestamp without time zone | not null
hbt | character(2) | not null
chain | character(2) | not null
pass | integer | not null

Indexes:
"reports_pkey" primary key, btree ("day", hbt, chain)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:38 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com