Define a function for counting reviews given a user name:
CREATE FUNCTION review_count(name: str) -> int64
USING EdgeQL $$
WITH MODULE default
SELECT count(
(
SELECT Review
FILTER .author.name = name
)
)
$$
Drop a user-defined function:
DROP FUNCTION review_count(name: str);
Define and use polymorphic function:
db> ...
CREATE FUNCTION make_name(name: str) -> str
USING EdgeQL $$ SELECT 'my_name_' ++ name $$;
CREATE
db> ...
CREATE FUNCTION make_name(name: int64) -> str
USING EdgeQL $$ SELECT 'my_name_' ++ <str>name $$;
CREATE
q>
SELECT make_name('Alice');
{'my_name_Alice'}
q>
SELECT make_name(42);
{'my_name_42'}