Search Postgresql Archives

One-off attempt at catalog hacking to turn bytea column into text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

As a one-off attempt to change a large table's 'bytea' column to
'text' with minimal I/O (where the 'bytea' contents is already valid
UTF8 and the database encoding is also UTF8, and the column is not
part of any index or anything involving collation), how unsafe is the
following?

UPDATE pg_attribute SET atttypid='text'::regtype::oid WHERE
attrelid=('schema_name.table_name')::regclass AND attname='col_name'
AND atttypid='bytea'::regtype::oid;

Additionally, if the 'bytea' happenned to also explicitly contain a
trailing NUL prior to the "conversion" (i.e. after the hack, the last
byte in the 'text' value would be NUL), would there be any obvious
problems with the above hack?

Thanks,
V.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux