Portgresql Useful Info

Change Column Type
alter table the_table alter column the_column type bigint using the_column::bigint
String to Ascii
SELECT array_agg(t)
FROM (
       SELECT ascii(regexp_split_to_table(column_name,'')) from table_name
     ) t ;
Note: '' = two single quote
Asci to Unicode (hex) value
to_hex(asci('P')) = 50 = U&'\0050'
select ascii('P'),chr(80),U&'\0050', to_hex(80);
80 P P 50
Replace Chr from Column
update table_name set column_name=replace(column_name, chr(65279), '');

Yorum Gönder

Daha yeni Daha eski