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

treat $$ as a reserved token #29

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

dimfeld
Copy link
Contributor

@dimfeld dimfeld commented Nov 24, 2023

Fixes #20.

The output from the example in that issue is now

CREATE
OR REPLACE FUNCTION generate_ulid() RETURNS uuid AS
$$
SELECT
  (
    lpad(
      to_hex(
        floor(
          extract(
            epoch
            FROM
              clock_timestamp()
          ) * 1000
        ) :: bigint
      ),
      12,
      '0'
    ) || encode(gen_random_bytes(10), 'hex')
  ) :: uuid;

$$
LANGUAGE SQL;

I think the :: should not have spaces around it but that can wait for another PR. For now, this allows Postgres to parse it properly.

@shssoichiro shssoichiro merged commit addc725 into shssoichiro:master Dec 5, 2023
4 checks passed
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

Successfully merging this pull request may close these issues.

Wrong formatted PostgreSQL
2 participants