You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a function takes in a named parameter and the parameter is used in the function body and referenced explicitly using the function name, the used function name is flagged as a false error claiming an incorrect FROM clause (probably because it expects a Select * from <function_name> statement).
To Reproduce
Create a function with a named parameter and use a explicit function parameter reference.
create or replace function users.select_with_function_ref (user_id uuid) returns table (
first_name text
) language sql security invoker as $$
select
first_name
FROM
users_hidden.users
where
id = select_with_function_ref.user_id;
$$;
Expected behavior
Named function parameters using an explicit function name as reference should be recognized as correct code.
System information
OS: windows
code editor: vs-code
pls version: 0.5.0
The text was updated successfully, but these errors were encountered:
the idea is to replace the fn params with a default value based on their
type:
```sql
create or replace function users.select_no_ref (user_id int4) returns table (
first_name text
) language sql security invoker as $$
select
first_name
FROM
users_hidden.users
where
id = user_id;
$$;
```
will become
```sql
create or replace function users.select_no_ref (user_id int4) returns table (
first_name text
) language sql security invoker as $$
select
first_name
FROM
users_hidden.users
where
id = 0; -- <-- here
$$;
```
## Todo
- [x] pass params to typechecker
- [x] implement `apply_identifiers`
fixes#353fixes#352
---------
Co-authored-by: Copilot <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Describe the bug
If a function takes in a named parameter and the parameter is used in the function body and referenced explicitly using the function name, the used function name is flagged as a false error claiming an incorrect FROM clause (probably because it expects a Select * from <function_name> statement).
To Reproduce
Create a function with a named parameter and use a explicit function parameter reference.
Expected behavior
Named function parameters using an explicit function name as reference should be recognized as correct code.
System information
The text was updated successfully, but these errors were encountered: