Skip to content

Instantly share code, notes, and snippets.

@andboson
Created March 7, 2017 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andboson/49c8d1400273a470a436288c9ecf068b to your computer and use it in GitHub Desktop.
Save andboson/49c8d1400273a470a436288c9ecf068b to your computer and use it in GitHub Desktop.
insert record with random field
insert into cups(reg_id, code, is_enabled, created_at, updated_at )
select
1 as reg_id,
UPPER(substr(md5(''||now()::text||random()::text), 1,8)) as code,
true as is_enabled,
to_date(now()::text,
'YYYY-MM-DD HH24:MI:SS') as created_at,
to_date(now()::text, 'YYYY-MM-DD HH24:MI:SS') as updated_at
from generate_series(1,4000000) on conflict DO NOTHING;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment