fix: wrap uuid_generate_v7 function in goose StatementBegin/End
goose splits SQL on semicolons and misinterprets dollar-quoted strings ($$...$$) as statement boundaries, causing a parse error on the PL/pgSQL function body. StatementBegin/End annotations tell goose to treat the block as a single statement. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
|||||||
-- UUID v7 generator (time-ordered, millisecond precision).
|
-- UUID v7 generator (time-ordered, millisecond precision).
|
||||||
-- Structure: 48-bit unix_ts_ms | 4-bit version (0111) | 12-bit rand_a | 2-bit variant (10) | 62-bit rand_b
|
-- Structure: 48-bit unix_ts_ms | 4-bit version (0111) | 12-bit rand_a | 2-bit variant (10) | 62-bit rand_b
|
||||||
-- ---------------------------------------------------------------------------
|
-- ---------------------------------------------------------------------------
|
||||||
|
-- +goose StatementBegin
|
||||||
CREATE OR REPLACE FUNCTION uuid_generate_v7()
|
CREATE OR REPLACE FUNCTION uuid_generate_v7()
|
||||||
RETURNS uuid
|
RETURNS uuid
|
||||||
AS $$
|
AS $$
|
||||||
@@ -38,6 +39,7 @@ BEGIN
|
|||||||
RETURN encode(uuid_bytes, 'hex')::uuid;
|
RETURN encode(uuid_bytes, 'hex')::uuid;
|
||||||
END
|
END
|
||||||
$$ LANGUAGE plpgsql VOLATILE;
|
$$ LANGUAGE plpgsql VOLATILE;
|
||||||
|
-- +goose StatementEnd
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------------
|
-- ---------------------------------------------------------------------------
|
||||||
-- Enums
|
-- Enums
|
||||||
|
|||||||
Reference in New Issue
Block a user