From: | Mike Ellsworth <nhrcommu(at)rochester(dot)rr(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Novice Postgresql-list <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Alter column |
Date: | 2006-08-14 12:38:46 |
Message-ID: | 44E06ED6.6050606@rochester.rr.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Tom Lane wrote:
>Mike Ellsworth <nhrcommu(at)rochester(dot)rr(dot)com> writes:
>
>
>>Is there a way to convert data type `datetime` into an integer
>>(unix_timestamp) while doing ALTER COLUMN `column_name` TYPE int4
>>USING CAST(`column_name` as integer) ...... something like this?
>>
>>
>
>Something involving extract(epoch) would do that ... but why do you
>want to? If the column is really timestamps then you are almost always
>best off to declare it as timestamps. When you have a client that wants
>a numeric version, they can do the extract(epoch) bit when they select
>the data (or you can make a view that does so, if the client code is
>too brain-dead to manage it for itself). The normal rule of good
>database design is that the database should have as much knowledge
>as possible about what it's storing, not as little as possible.
>
> regards, tom lane
>
Actually, we do not have a specific purpose in mind. We're trying to
make a simple GUI that will allow users to do this if they (for whatever
the reason) feel the need.
Your point is a good one though and we should probably include a
Javascript warning for this particular 'feature'.
Thanks,
Mike
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | ben sewell | 2006-08-14 12:45:07 | can someone tell me what's wrong with this procedure? |
Previous Message | Tom Lane | 2006-08-14 12:17:58 | Re: Alter column |