Extended ability to alter column type when empty
| От | David Andersen |
|---|---|
| Тема | Extended ability to alter column type when empty |
| Дата | |
| Msg-id | c6bf5b380902170538v335ce5d1kaf28456ce5c14823@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: Extended ability to alter column type when empty
|
| Список | pgsql-general |
Hi,
I am a real newbee and I hope this is the right place to post a feature request.
I am receiving data from a csv file where one column has a strange data format. It would be nice if I could use Copy From with to_timestamp to transform the date. As far as I know this is not possible to do in one step (unlike MySQL I believe). I, therefore, have to first read large amounts of CSV data into one table where the data is a char(15) column. Then create another table using:
CREATE TABLE T (like tempT);
ALTER TABLE T ALTER COLUMN thedate TYPE TIMESTAMP;
However, then I run into:
ERROR: column "thedate" cannot be cast to type "pg_catalog.timestamp"
This error comes even though the table is empty. Could it be an idea to allow this for empty tables? Am I missing something obvious in my unreasonably complicated approach?
Regards,
David
I am a real newbee and I hope this is the right place to post a feature request.
I am receiving data from a csv file where one column has a strange data format. It would be nice if I could use Copy From with to_timestamp to transform the date. As far as I know this is not possible to do in one step (unlike MySQL I believe). I, therefore, have to first read large amounts of CSV data into one table where the data is a char(15) column. Then create another table using:
CREATE TABLE T (like tempT);
ALTER TABLE T ALTER COLUMN thedate TYPE TIMESTAMP;
However, then I run into:
ERROR: column "thedate" cannot be cast to type "pg_catalog.timestamp"
This error comes even though the table is empty. Could it be an idea to allow this for empty tables? Am I missing something obvious in my unreasonably complicated approach?
Regards,
David
В списке pgsql-general по дате отправления: