Re: Converting char to varchar automatically
От
Andrus
Тема
Re: Converting char to varchar automatically
Дата
Msg-id
9CDA39C9CFD1404FA57F9A2B61BAC62B@dell2
Ответ на
Re: Converting char to varchar automatically (Melvin Davidson)
Список
Дерево обсуждения
Converting char to varchar automatically "Andrus" <kobruleht2@hot.ee>
Re: Converting char to varchar automatically Andy Colson <andy@squeakycode.net>
How to use record variable with non-null domain in plpgsql "Andrus" <kobruleht2@hot.ee>
Re: How to use record variable with non-null domain in plpgsql Tom Lane <tgl@sss.pgh.pa.us>
How to speed up delete where not in "Andrus" <kobruleht2@hot.ee>
Re: How to speed up delete where not in David Rowley <david.rowley@2ndquadrant.com>
How to drop user if objects depend on it "Andrus" <kobruleht2@hot.ee>
Ynt: How to drop user if objects depend on it Neslisah Demirci <neslisah.demirci@markafoni.com>
Re: Ynt: How to drop user if objects depend on it Jerry Sievers <gsievers19@comcast.net>
Re: How to drop user if objects depend on it Thom Brown <thom@linux.com>
Re: How to drop user if objects depend on it "Andrus" <kobruleht2@hot.ee>
Re: How to drop user if objects depend on it Adrian Klaver <adrian.klaver@aklaver.com>
Re: How to drop user if objects depend on it "Andrus" <kobruleht2@hot.ee>
Re: How to drop user if objects depend on it Tom Lane <tgl@sss.pgh.pa.us>
Re: How to drop user if objects depend on it Tom Lane <tgl@sss.pgh.pa.us>
Re: How to drop user if objects depend on it "Andrus" <kobruleht2@hot.ee>
Re: How to drop user if objects depend on it Tom Lane <tgl@sss.pgh.pa.us>
Re: How to drop user if objects depend on it "Andrus" <kobruleht2@hot.ee>
Re: How to drop user if objects depend on it Tom Lane <tgl@sss.pgh.pa.us>
How to get correct local time "Andrus" <kobruleht2@hot.ee>
Re: How to get correct local time Vitaly Burovoy <vitaly.burovoy@gmail.com>
Re: How to get correct local time Vitaly Burovoy <vitaly.burovoy@gmail.com>
Re: How to get correct local time Adrian Klaver <adrian.klaver@aklaver.com>
How to use row values as function parameters "Andrus" <kobruleht2@hot.ee>
Re: How to use row values as function parameters Adrian Klaver <adrian.klaver@aklaver.com>
Re: How to use row values as function parameters "David G. Johnston" <david.g.johnston@gmail.com>
Re: How to use row values as function parameters "Andrus" <kobruleht2@hot.ee>
Re: How to use row values as function parameters Adrian Klaver <adrian.klaver@aklaver.com>
Re: How to use row values as function parameters "David G. Johnston" <david.g.johnston@gmail.com>
Re: How to drop user if objects depend on it "Andrus" <kobruleht2@hot.ee>
Re: How to drop user if objects depend on it Adrian Klaver <adrian.klaver@aklaver.com>
Re: How to drop user if objects depend on it Melvin Davidson <melvin6925@gmail.com>
Re: How to drop user if objects depend on it "Andrus" <kobruleht2@hot.ee>
Re: How to drop user if objects depend on it Melvin Davidson <melvin6925@gmail.com>
Re: How to drop user if objects depend on it "Andrus" <kobruleht2@hot.ee>
Re: How to drop user if objects depend on it Melvin Davidson <melvin6925@gmail.com>
Re: How to speed up delete where not in Melvin Davidson <melvin6925@gmail.com>
Re: How to use record variable with non-null domain in plpgsql "Andrus" <kobruleht2@hot.ee>
Re: Converting char to varchar automatically Melvin Davidson <melvin6925@gmail.com>
Re: Converting char to varchar automatically "Andrus" <kobruleht2@hot.ee>
Re: Converting char to varchar automatically "Andrus" <kobruleht2@hot.ee>
Re: Converting char to varchar automatically Melvin Davidson <melvin6925@gmail.com>
Re: Converting char to varchar automatically "Andrus" <kobruleht2@hot.ee>
Re: Converting char to varchar automatically Melvin Davidson <melvin6925@gmail.com>
Re: Converting char to varchar automatically "Andrus" <kobruleht2@hot.ee>
Re: Converting char to varchar automatically Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: Converting char to varchar automatically "Andrus" <kobruleht2@hot.ee>
Hi!
Using Toms recommendation I added not attisdropped and now got the query
SELECT 'ALTER TABLE ' || quote_ident(n.nspname) || '.'
|| quote_ident(c.relname)
|| ' ALTER COLUMN ' || quote_ident(a.attname) || ' TYPE
varchar;'
FROM pg_class c
JOIN pg_namespace n ON n.oid = c.relnamespace
JOIN pg_attribute a ON a.attrelid = c.oid
JOIN pg_type t ON t.oid = a.atttypid
WHERE t.typname = 'bpchar'
AND c.relkind = 'r'
AND n.nspname <> 'pg_catalog' and not attisdropped;
Will this create commands which replace all user-defined char things in
database to varchar ?
"TYPE varchar" creates single character column so most alter table command
will fail.
How to change this so that original char column width is kept ?
I looked into tables used in this query but havent found column which holds
char column defined width.
How get it or is it better to re-write this query using informational_schema
?
How to change this query so that it creates single alter table command for
every table
(with multiple alter column clauses) to increase conversion speed ?
Andrus.
В списке pgsql-general по дате отправления