Skip to content

Instantly share code, notes, and snippets.

@carlosspohr
Created August 15, 2017 11:24
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 carlosspohr/80176f858c277be332ae8d0c8968460a to your computer and use it in GitHub Desktop.
Save carlosspohr/80176f858c277be332ae8d0c8968460a to your computer and use it in GitHub Desktop.
Instance of how to use uuids on Postgres.
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
select uuid_generate_v4();
SELECT uuid_in(md5(random()::text || now()::text)::cstring);
create table teste (
id uuid not null primary key
);
insert into teste (id)values(uuid_generate_v4())
;
select * from teste;
select
uuid_generate_v4() as bla;
union all
uuid_generate_v4() as bla;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment