I am receiving the error in the title. The weird thing for me is that there is no colon anywhere in my SQL code.
CREATE OR REPLACE FUNCTION "CreateUser" (
"@first_name" VARCHAR(25),
"@last_name" VARCHAR(25),
"@email" VARCHAR(254),
"@password" VARCHAR(250)
)
RETURNS UUID AS
$func$
DECLARE "id" UUID;
BEGIN
"id" = uuid_generate_v4();
INSERT INTO
"users" (
"id",
"first_name",
"last_name",
"email",
"password"
)
VALUES (
"id",
"@first_name",
"@last_name",
"@email",
"@password"
);
RETURN "id";
END;
$func$ LANGUAGE PLPGSQL;
The field types are all the same so it can't be a type issue.
Is there a semicolon missing somewhere or is this just structure incorrectly altogether?
It turns out that I do not have the package uuid_generate_v4();
setup on sql and not sure how to support it so at least for the time being, I created a uuid on the server and passed it into sql.
CREATE OR REPLACE FUNCTION "CreateUser" (
"@newid" UUID,
"@first_name" VARCHAR(25),
"@last_name" VARCHAR(25),
"@email" VARCHAR(254),
"@password" VARCHAR(250)
)
RETURNS UUID AS
$func$
DECLARE "id" UUID;
BEGIN
INSERT INTO
"users" (
"id",
"first_name",
"last_name",
"email",
"password"
)
VALUES (
"@newid",
"@first_name",
"@last_name",
"@email",
"@password"
);
RETURN "id";
END;
$func$ LANGUAGE PLPGSQL;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.