Обсуждение: How do I change data type from text to bool?

Поиск
Список
Период
Сортировка

How do I change data type from text to bool?

От
"Donald Braman"
Дата:
I have a table/class filled with records/instances in which I accidentally
set the fields/attributes data type to text rather than boolean. I now have
75,000 records with 't' and 'f' So now I want to change the attributes to
bool? I can't find anything on changing data types in the integrated docs (I
searched them, didn't read all of them). Did I miss it? Is there an easy way
to do this? -Don

Donald Braman
donald.braman@yale.edu


Re: How do I change data type from text to bool?

От
"Stefan Waidele jun."
Дата:
At 18:39 19.02.2001 -0500, Donald Braman wrote:
>I have a table/class filled with records/instances in which I accidentally
>set the fields/attributes data type to text rather than boolean. I now have
>75,000 records with 't' and 'f' So now I want to change the attributes to
>bool? I can't find anything on changing data types in the integrated docs (I
>searched them, didn't read all of them). Did I miss it? Is there an easy way
>to do this? -Don

You might have to pg_dump the table, change the definition in the dump,
drop the table and recreate it with in psql with \i

I am not the great expert on this. I think there are not all SQL-Specials
restored the way they were. With a plain table without triggers et. al. it
should be alright.

If I missed something, please tell me,

Stefan