Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

creating table with uri type to uuid_generate #11

Open
Outstep opened this issue Oct 8, 2018 · 1 comment
Open

creating table with uri type to uuid_generate #11

Outstep opened this issue Oct 8, 2018 · 1 comment

Comments

@Outstep
Copy link

Outstep commented Oct 8, 2018

Hello,

I am trying to create a PG table such that:

CREATE TABLE websites (
id serial primary key,
site_link uri,
site_sha1 uuid NOT NULL DEFAULT uuid_generate_v5(uuid_ns_url(), site_link),
site_md5 uuid NOT NULL DEFAULT uuid_generate_v3(uuid_ns_url(), site_link)
);

but I think that I need to be able to send the site_link as a text input to the "uuid_generate_5/3()"

How can I cast the URI as text?

Thanks,

@cantoute
Copy link

cantoute commented Apr 16, 2020

this isn't a bug...
By now I guess you have found how to cast...

But in case here is an example

CREATE TABLE websites (
    id serial primary key,
    site_link uri,
    site_sha1 uuid NOT NULL DEFAULT uuid_generate_v5(uuid_ns_url(), site_link::text),
    site_md5 uuid NOT NULL DEFAULT uuid_generate_v3(uuid_ns_url(), site_link::text)
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant