Replacing all CHAR colums with VARCHAR

Поиск
Список
Период
Сортировка
От Andrus
Тема Replacing all CHAR colums with VARCHAR
Дата
Msg-id enc9oa$1c4q$1@news.hub.org
обсуждение исходный текст
Ответы Re: Replacing all CHAR colums with VARCHAR  (Richard Huxton <dev@archonet.com>)
Re: Replacing all CHAR colums with VARCHAR  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-general
I have CHAR columns in database in 500 tables. There are currently no
VARCHAR columns.

My C# application receives character data with trailing spaces from npgsql.
This makes application code complicated. Application must remove trailing
spaces from incoming data for C# string manipulation to work.

Also Tom Lane strongly recommends using VARCHAR always and never use CHAR
columns.

Is it reasonable do convert all CHAR columns in database to VARCHAR columns
in whole database.
Where to find such script ?
Shoult I make a loop over all columns and execute ALTER TABLE statements
in transaction making all constraints deferred?

I have also some triggers, indexes and sequences in database and execute
statements into database which contain a lot of operations with CHAR
columns.

Will database work OK after such conversion?
What things may be broken ?

Or is it better to hack npgsql code so that it removes trailing spaces
itself ?

Andrus.



В списке pgsql-general по дате отправления:

Предыдущее
От: "Ing. Dan Horáček"
Дата:
Сообщение: ldap auth problem
Следующее
От: "Andrus"
Дата:
Сообщение: Replacing all CHAR colums with VARCHAR