Skip to content

Instantly share code, notes, and snippets.

View ilyakaznacheev's full-sized avatar
🌐
citizen of the world

Ilya Kaznacheev ilyakaznacheev

🌐
citizen of the world
View GitHub Profile
@stereoscott
stereoscott / random_text.sql
Created June 22, 2014 17:38
PostgreSQL random text function
-- http://www.postgresql.org/message-id/[email protected]
CREATE OR REPLACE FUNCTION
random_text(INTEGER)
RETURNS TEXT
LANGUAGE SQL
AS $$
SELECT array_to_string(array(
SELECT SUBSTRING('23456789abcdefghjkmnpqrstuvwxyz'
FROM floor(random()*31)::int+1 FOR 1)