From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
---|---|
To: | pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org> |
Subject: | generating non-unicode 8-bit text data in SQL_ASCII encoding |
Date: | 2008-02-20 12:24:04 |
Message-ID: | 87lk5fx1cr.fsf@oxford.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
In trying to generate random incompressible data I ran into this. I thought we
said char()/ascii() would be allowed to generate either unicode code points if
your encoding was unicode or 8-bit ascii if it's SQL_ASCII.
Is there any way to generate random 8-bit characters in SQL_ASCII encoding
now?
postgres=# \l
List of databases
Name | Owner | Encoding
-----------+-------+-----------
postgres | stark | SQL_ASCII
template0 | stark | SQL_ASCII
template1 | stark | SQL_ASCII
(3 rows)
postgres=# select "char"((random()*255)::integer+1);
char
------
'
(1 row)
postgres=# select "char"((random()*255)::integer+1);
ERROR: "char" out of range
postgres=# select "char"((random()*255)::integer+1);
ERROR: "char" out of range
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's Slony Replication support!
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark | 2008-02-20 12:26:32 | More char()/ascii() |
Previous Message | Sergey E. Koposov | 2008-02-20 12:18:53 | Re: failed assertion in toasting code |